diff --git a/jquery.flexslider.js b/jquery.flexslider.js index eaa007c9..aea28535 100644 --- a/jquery.flexslider.js +++ b/jquery.flexslider.js @@ -104,7 +104,7 @@ // KEYBOARD: if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) { - $(document).bind('keyup', function(event) { + $(document).on('keyup', function(event) { var keycode = event.keyCode; if (!slider.animating && (keycode === 39 || keycode === 37)) { var target = (slider.vars.rtl? @@ -121,7 +121,7 @@ } // MOUSEWHEEL: if (slider.vars.mousewheel) { - slider.bind('mousewheel', function(event, delta, deltaX, deltaY) { + slider.on('mousewheel', function(event, delta, deltaX, deltaY) { event.preventDefault(); var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev'); slider.flexAnimate(target, slider.vars.pauseOnAction); @@ -137,9 +137,10 @@ // SLIDSESHOW if (slider.vars.slideshow) { if (slider.vars.pauseOnHover) { - slider.hover(function() { + slider.on('mouseenter', function() { if (!slider.manualPlay && !slider.manualPause) { slider.pause(); } - }, function() { + }); + slider.on('mouseout', function() { if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); } }); } @@ -157,7 +158,7 @@ if (touch && slider.vars.touch) { methods.touch(); } // FADE&&SMOOTHHEIGHT || SLIDE: - if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); } + if (!fade || (fade && slider.vars.smoothHeight)) { $(window).on("resize orientationchange focus", methods.resize); } slider.find("img").attr("draggable", "false"); @@ -274,7 +275,7 @@ methods.controlNav.active(); - slider.controlNavScaffold.delegate('a, img', eventType, function(event) { + slider.controlNavScaffold.on( eventType, 'a, img', function(event) { event.preventDefault(); if (watchedEvent === "" || watchedEvent === event.type) { @@ -299,7 +300,7 @@ slider.controlNav = slider.manualControls; methods.controlNav.active(); - slider.controlNav.bind(eventType, function(event) { + slider.controlNav.on(eventType, function(event) { event.preventDefault(); if (watchedEvent === "" || watchedEvent === event.type) { @@ -356,7 +357,7 @@ methods.directionNav.update(); - slider.directionNav.bind(eventType, function(event) { + slider.directionNav.on(eventType, function(event) { event.preventDefault(); var target; @@ -404,7 +405,7 @@ methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play'); - slider.pausePlay.bind(eventType, function(event) { + slider.pausePlay.on(eventType, function(event) { event.preventDefault(); if (watchedEvent === "" || watchedEvent === event.type) { @@ -794,8 +795,8 @@ } // Unbind previous transitionEnd events and re-bind new transitionEnd event - slider.container.unbind("webkitTransitionEnd transitionend"); - slider.container.bind("webkitTransitionEnd transitionend", function() { + slider.container.off("webkitTransitionEnd transitionend"); + slider.container.on("webkitTransitionEnd transitionend", function() { clearTimeout(slider.ensureAnimationEnd); slider.wrapup(dimension); }); @@ -976,14 +977,14 @@ slider.doMath(); if(slider.vars.rtl){ if (slider.isFirefox) { - slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "right", "display": "block"}); + slider.newSlides.css({"width": slider.computedW + 'px', "marginRight" : slider.computedM + 'px', "float": "right", "display": "block"}); } else { - slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"}); + slider.newSlides.css({"width": slider.computedW + 'px', "marginRight" : slider.computedM + 'px', "float": "left", "display": "block"}); } } else{ - slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"}); + slider.newSlides.css({"width": slider.computedW + 'px', "marginRight" : slider.computedM + 'px', "float": "left", "display": "block"}); } // SMOOTH HEIGHT: if (slider.vars.smoothHeight) { methods.smoothHeight(); } @@ -1142,9 +1143,9 @@ }; // Ensure the slider isn't focussed if the window loses focus. - $( window ).blur( function ( e ) { + $( window ).on( 'blur', function ( e ) { focused = false; - }).focus( function ( e ) { + }).on( 'focus', function ( e ) { focused = true; });