jquery - Disable/enable touch events on flexslider -


im using flexslider slide content: http://iea.uili.com.br/v4/ thing whant disable touch when zoom in , enable when zoom out, same keyboard control!

here function when click on building zoom in

function janelas(){            $('.popup').click(function() {          var $id = $(this).attr('class').split(' ')[2];         $('.menu_janela').fadeout('fast');          $("ul.flex-direction-nav").addclass('hide');         settimeout(function(){             console.log('.'+$id+'-popup')             $('.'+$id+'-popup').fadein('fast');         },600);       });     } 

here function when zoom out

function fecha(){     $('.fechaa').click(function()  {          $("ul.flex-direction-nav").removeclass('hide');         $('.menu_janela').fadeout();         $('.view1').click();     });      $('.fechab').click(function()  {          $("ul.flex-direction-nav").removeclass('hide');         $('.menu_janela').fadeout();         $('.view2').click();     });      $('.fechac').click(function()  {          $("ul.flex-direction-nav").removeclass('hide');         $('.menu_janela').fadeout();         $('.view3').click();     });      $('.zoomcontainer').click(function()  {          $("ul.flex-direction-nav").removeclass('hide');         $('.menu_janela').fadeout();     }); } 

and here function slider

function slider(){     $captions = $('.captions');         $('.flexslider').flexslider({         animation: "slide",         slideshow: false,         animationspeed: 1500,         controlnav: false,         keyboard: true,         touch: true,         start: function(slider) {             $activecaption = $('.flex-active-slide .flex-caption');             $captions.html($activecaption.text());              $('.loading-container').fadeout(function() {               $(this).remove();             });             $('.centro').centro();              janelas();             fecha();         },         before: function(slide) {          },         after: function(slide) {             $activecaption = $('.flex-active-slide .flex-caption');             $captions.html($activecaption.text());          },         end: function(slide) {         },     }); } 

i had similar problem, had disable slider when user selects text of slides - because when select text after slide slider - selection stays visible, although you're on slide. pretty weird :) … so, did is:

  1. made function that's called on every 200ms , sets global variable true or false, depending on if text selected or not.

  2. added 3 if statements in slider code, checks variable, , if there selected text - i'm not changing slide.

the 3 places inside ontouchstart, ontouchmove , ontouchend internal callbacks, , code inside them executes if no text selected.

i'm still improving this, decided share progress far :) …


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -