javascript - Unbind custom function from element -


i have following code:

    $( window ).resize(function() {         if (matchmedia('only screen , (min-width: 992px)').matches) {             $('#second').parallax();             $('.sketches-1').parallax();             $('#fifth').parallaxfifth();         }         else{             //...         }    });  

i wish remove parallax function on mobile devices, how can achieve this?

use:

var parallax = function() {     if (matchmedia('only screen , (min-width: 992px)').matches) {         $('#second').parallax();         $('.sketches-1').parallax();         $('#fifth').parallaxfifth();     }     else{         //...     } }; $(window).resize(parallax);  //some code here... $(window).off('resize', parallax); 

if don't want use effect on mobile use:

function ismobile() {   /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent); }  if (!ismobile()) {   $(window).resize(parallax);  } 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -