jquery.parallax-scroll icon indicating copy to clipboard operation
jquery.parallax-scroll copied to clipboard

Disable Temporarily on Mobile Version

Open welyanto opened this issue 8 years ago • 3 comments

Hello, is it possible to disable temporarily only on mobile version, ex: if(screen.width > 1024) { ParallaxScroll.init(); } else { $('.myclass').removeAttr("data-parallax"); }

how we can remove the data-parallax attribute temporarily and set it back once the screen width is more than 1024px? seems the ParallaxScroll.init() not trigger the removed attribute back. Any idea will be appreciated! Big Thanks :)

welyanto avatar Jan 19 '17 16:01 welyanto

Smth like this ? $(window).bind('resize', function(e){ if (($(window).width() >= 1024)) { if (window.RT) clearTimeout(window.RT); window.RT = setTimeout(function() { $('.myclass').removeAttr("data-parallax"); }, 1); }

friizu avatar Jan 19 '17 16:01 friizu

@friizu i'm not an expert javascript/jquery but what are you trying to accomplish there? seems there some missing brackets, i got an error on the scripts

welyanto avatar Jan 19 '17 17:01 welyanto

Just add parallax-scroll as you normally would.

Create a CSS rule:

.no-transform{ transform:none; }

With jQuery:

if($(window).width() > 768){ $('.parallax-content-id').removeClass('no-transform'); }else{ $('.parallax-content-id').addClass('no-transform'); }

ricebandit avatar Mar 20 '17 18:03 ricebandit