Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Temporarily on Mobile Version #9

Open
welyanto opened this issue Jan 19, 2017 · 3 comments
Open

Disable Temporarily on Mobile Version #9

welyanto opened this issue Jan 19, 2017 · 3 comments

Comments

@welyanto
Copy link

welyanto commented Jan 19, 2017

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 :)

@friizu
Copy link

friizu commented Jan 19, 2017

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); }

@welyanto
Copy link
Author

@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

@ricebandit
Copy link

ricebandit commented Mar 20, 2017

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');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants