In bootstrap 3 exist touch events even swipe events eg in Carousel Plugin

In bootstrap 3 exist touch events even swipe events eg in Carousel Plugin - or these needed the help of another framework like jQMobile…?

Bootstrap doesn’t doesn’t have anything special for touch events, but it pulls in jQuery if I remember correctly, which means you can do:

$('#whatever').on({ 'touchstart' : function(){ /* do something... */ } });

If you’re after more than that, you can build your own using the following events:

  • touchstart
  • touchmove
  • touchend
  • touchcancel

For example:

document.addEventListener('touchmove', function(e) {
    e.preventDefault();
    var touch = e.touches[0];
    alert(touch.pageX + " - " + touch.pageY);
}, false);

Or, you could use a multitouch library like Hammer.js.

Then you can do:

$slider
    .hammer({prevent_default: true})
    .bind('dragstart', function(e) { // And mousedown
        // Get ready to drag
    })

My answer is taken mostly from here: http://stackoverflow.com/questions/4755505/how-to-recognize-touch-events-using-jquery-in-safari-for-ipad-is-it-possible

needed only jQuery that bootstrap come with or additionally needed jQuery Mobile for touch events?

For what I posted, only the jQuery library that Bootstrap pulls in.

you know Intel XDK/Hybrid Dev, that also use Bootstrap among others for mobile dev hybrid…
and for Bootstrap having taken MOBILE FIRST approach - the touch evens even in newest version needed handle - are yet build in?

reply - one:

yes - needed special addition - the touch evens
no - in newest version included by default

Sorry I don’t understand what you are asking

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.