wordpress - jquery scroll the height of hovered div -


i have wordpress loop. every article has class ".post". have button class ".skip" every .post. when button clicked want page scrolled next .post in loop.

i'm using

$(function(){     $(window).scroll(function(){         $(".post").each(function(){             var height = $(".post").height();             var scroll = $(window).scrolltop();             $(".skip").click(function(){                 $(window).scrolltop(scroll+height);             });         });     }); }); 

something done not should!

i mean..the page scrolls on click height of first .post (no matter .post .skip button belongs to)

help!

the .post container wp loop

<article <?php post_class(); ?>>     <div class="skip">skip</div>     <?php if ( has_post_thumbnail()) :  ?>         <div class="container">             <div>                 <?php the_post_thumbnail(); ?>             </div>         <h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>         </div>     <?php else: ?>          <h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>     <?php endif; ?>     <?php the_content(); ?>     <a href="<?php the_permalink(); ?>" class="more">more</a> </article> 

$(function () {     $(".skip").click(function () {         var height = $(this).parent('article').height();         var scroll = $(window).scrolltop();         $(window).scrolltop(scroll + height);     }); }); 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -