Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #13185 - keyboard support for carousel #13787

Merged
merged 1 commit into from
Jun 11, 2014
Merged

fix #13185 - keyboard support for carousel #13787

merged 1 commit into from
Jun 11, 2014

Conversation

fat
Copy link
Member

@fat fat commented Jun 11, 2014

No description provided.

@@ -18,7 +18,7 @@
// =========================

var Carousel = function (element, options) {
this.$element = $(element)
this.$element = $(element).on('keydown', $.proxy(this.keydown, this))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably namespace this, though the mouseenter and mouseleave events aren't either so I'm not so sure...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm yeah good call

@fat
Copy link
Member Author

fat commented Jun 11, 2014

lg?

}

e.preventDefault()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems more fitting 😄

Carousel.prototype.keydown = function (e) {
  if (!/37|39/.test(e.which)) return

  this[e.which == 37 ? 'prev' : 'next']()

  e.preventDefault()
}

Also, ref

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it was a switch statement because mark and i were going back and forth with adding a first/last option

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also think the switch is a bit more elegant in this case - only one condition, etc

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but the semicolons aren't that elegant.

@cvrebert cvrebert added this to the v3.2.0 milestone Jun 11, 2014
@hnrch02
Copy link
Collaborator

hnrch02 commented Jun 11, 2014

Looking good to whom? You might wanna cc someone specific in.
I say :shipit: (Even though the semicolon situation in the switch could be improved.)

fat added a commit that referenced this pull request Jun 11, 2014
fix #13185 - keyboard support for carousel
@fat fat merged commit 6ac5708 into master Jun 11, 2014
@fat fat deleted the fat-3731 branch June 11, 2014 22:19
@mdo mdo mentioned this pull request Jun 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants