Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop WOW JS + CSS animate on smaller devices?

1) I've looked all over th web and just was wondering if anyone of you guys come across this problem where you wanted to stop the WOW JS animation for certain devices or/and for smaller screen sizes?!

2) Also it's quite annoying to see css the animation from time to time when navigating through out the website (ux-wise would be ideal to see it once), so I was thinking to use cookies for this purpose but didn't know how to approach it, because by the time JS file is loaded at the bottom of the page the animation has been done...?!

Please bear in mind that I also use the data attributes for delays and durations, so it's not only by removing the WOW class!

Any idea would really be appreciated :) Many thanks

like image 686
ZAD Avatar asked Feb 20 '15 10:02

ZAD


4 Answers

For one-liner addicts like me:

new WOW({ mobile:false }).init();
like image 85
Etienne Dupuis Avatar answered Nov 18 '22 16:11

Etienne Dupuis


a pure css solution would be (even if !important is quite ugly...) :

@media screen and (max-width: 800px) {
    .wow{
        animation-name: none !important;
        visibility: visible !important;
    }
}

The inline styles added by wow will still be there but overwritten by these 2 lines, they won't apply anymore.

like image 35
gwenaelle georget Avatar answered Nov 18 '22 15:11

gwenaelle georget


Change the default settings

wow = new WOW(
{
boxClass:     'wow',      // default
animateClass: 'animated', // default
offset:       0,          // default
mobile:       true,       // default
live:         true        // default
}
                )
wow.init();

to

mobile:false
like image 18
Samuel Avatar answered Nov 18 '22 16:11

Samuel


Hope this helps others too;

$('.wow').removeClass('wow');

Place this at the bottom of your page, however for those that want to remove the WOW JS animation for certain devices then this is for you;

if(isMobile || isTablet) {
    $('.wow').addClass('wow-removed').removeClass('wow');
} else {
    $('.wow-removed').addClass('wow').removeClass('wow-removed');
}

Put the logic behind isMobile and isTablet yourself, and I'm sure everybody's are able to do that.

Thanks

like image 7
ZAD Avatar answered Nov 18 '22 15:11

ZAD