Hello,
I've been playing around with the Twitter bootstrap code, and wanted to see if I could adapt the JQuery Carousel plugin to handle both click and keydown events in the object map format. The click handling seems to work, but I'm not able to pass keydown events. Am I missing something really simple here?
/* CAROUSEL DATA-API
* ================= */
$(function () {
$('body').on({
'click.carousel.data-api': function(e){
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
$target.carousel(options)
e.preventDefault()
},
'keydown.carousel.data-api': function(e){
switch(e.keyCode) {
case 37: // left
e.preventDefault();
console.log('left');
break;
case 38: // up
e.preventDefault();
console.log('up');
break;
case 39: //right
e.preventDefault();
console.log('right');
break;
case 40: // down
console.log("down");
e.preventDefault();
break;
}
}
}, '[data-slide]')
})