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

Mobile turn off #3

Closed
BackuPs opened this issue Mar 28, 2016 · 5 comments
Closed

Mobile turn off #3

BackuPs opened this issue Mar 28, 2016 · 5 comments

Comments

@BackuPs
Copy link

BackuPs commented Mar 28, 2016

Hi

In your demo viewed on a f.e. ipad (version 2 ios 9.3) you see that the background images are loaded and become visible after scrolling down in the page. Is there a way to show them correctly on page load? Is there a way to just show the background image on mobile without parallaxing like skrollr does?

http://free.nkdev.info/jarallax/scale-opacity-parallax.html

Same effect here (note i turned off transForm but that did not resolve the issue. But it did work better on IE.)

Looking forward to your reply.

Best regards,
BackuPs

@nk-o
Copy link
Owner

nk-o commented Mar 28, 2016

Hi.

Why not check for mobile device before init plugin? Will work only if you use js initialization (without data-jarallax attribute)

var isMobile = /Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/g.test(navigator.userAgent || navigator.vendor || window.opera);
if(!isMobile) {
    $('.jarallax').jarallax();
}

Best regards, nK.

@BackuPs
Copy link
Author

BackuPs commented Mar 28, 2016

i am using the data-attribute way..... :-) now i have to rewrite it again. I will write around it.

Thanks for the suggestion

@nk-o
Copy link
Owner

nk-o commented Mar 28, 2016

If you want to add attributes on the tags, try this way (change "my-attribute-name" on something you want):

HTML:

<div class="jarallax" data-my-attribute-name='{"type": "scale-opacity"}' style="background-image: url(images/image1.jpg);"></div>

JS:

var isMobile = /Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/g.test(navigator.userAgent || navigator.vendor || window.opera);
if(!isMobile) {
    $('.jarallax').each(function () {
        $(this).jarallax($(this).data('my-attribute-name') || {});
    })
}

@BackuPs
Copy link
Author

BackuPs commented Mar 28, 2016

Hi

Thanks i wrote it a bit different but it works fine. Thanks for the feed back and support.

Best regards,
BackuPs

@nk-o nk-o closed this as completed Mar 28, 2016
@BackuPs
Copy link
Author

BackuPs commented Mar 30, 2016

Hi

The code does not work and the dataOptions are empty and reverting to default.

Do you have a better fix?

Best regards,
BackuPs

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

2 participants