javascript - Strange jquery 'viewport' behaviour -


i'm developing wordpress site has lot of animations effects - fade-in , fade-out on changeing tabs etc. 1 of them slideing in boxes bottom when element in viewport. i'm using script:

function checkvisible() {     var elm = this;     var eval = eval || "visible";     var vph = $(window).height(),         st = $(window).scrolltop(),          y = $(elm).offset().top,         elementheight = $(elm).height();      if (eval == "visible") return ((y < (vph + st)) && (y > (st - elementheight)));  }    $(window).scroll(function(){   $('.module').filter(checkvisible).addclass('come-in'); });  $( document ).ready(function() {   $('.module').filter(checkvisible).addclass('come-in');  }); 

it's not mine, found smowhere on stackoverflow. problem is, worked while, after time started act strange: on subpages adds 'come in' class without checking if 'module' in viewport or not. , on 'post' pages works.. when scrolling bottom top.

as read lot of problems may caused double jquery cdn, don't think thats problem:

    <head> <meta charset="utf-8" />  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>osiemzero</title> <script type="text/javascript">document.body.classname+='animate-in'</script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="http://serwer1460278.home.pl/osiemzero_wp/wp-content/themes/osiemzero/js/animations.js"></script> <script src="http://serwer1460278.home.pl/osiemzero_wp/wp-content/themes/osiemzero/js/custom_css.js"></script> <script type='text/javascript' src='http://serwer1460278.home.pl/osiemzero_wp/wp-content/plugins/ml-slider/assets/sliders/flexslider/jquery.flexslider-min.js?ver=3.3.6'></script> <link rel='stylesheet' id='metaslider-flex-slider-css'  href='http://serwer1460278.home.pl/osiemzero_wp/wp-content/plugins/ml-slider/assets/sliders/flexslider/flexslider.css?ver=3.3.6' type='text/css' media='all' property='stylesheet' /> <link rel="stylesheet" href=" http://serwer1460278.home.pl/osiemzero_wp/wp-content/themes/osiemzero/css/font-awesome.min.css"> <link rel="stylesheet" href="http://serwer1460278.home.pl/osiemzero_wp/wp-content/themes/osiemzero/css/styles.css">    </head> 

i tried lot of scripts check if element in viewport (even jquery plugins), had same effect, that's not problem.

thank possible.


Comments

Popular posts from this blog

How to use SUM() in MySQL for calculated values -

loops - Spock: How to use test data with @Stepwise -