javascript - Working with Animsition and Infinite Scroll js -


i using infinite scroll js (with behaviour set twitter) load in new contents on index page. concern is, how re-initiate animistion on new posts being loaded via infinite scroll? have described in detail page structure being followed , appreciate if can kindly share solution same.

<!doctype html>  <html lang="en">   <head></head>   <body>    <div class="animsition">     <header class="header"></header>     <main class="main">      <section class="main-body">       <div id="infinite-scroll">        <article class="post">         <div class="post-body">          <h2 class="post-title">           <a href="" class="nav-link" title=""></a>          <h2>         </div>        </article>       </div>       <div class="pagination">        <a href="" class="next">load older items</a>       </div>      </section>     </main>    <footer class="footer"></footer>     </div>  </body> </html> 

and here js,

$(".animsition").animsition({  inclass : 'fade-in',  outclass : 'fade-out',  linkelement : '.nav-link',  overlay : false });  $(function() {  $("#infinite-scroll").infinitescroll({    navselector: ".pagination",   nextselector: ".next",   itemselector: ".post",   behavior: "twitter"  }, function(newelements){  }); 

i running same problem (animsition + infinite scroll) , couldn't find answer here on or anywhere else matter performed minor surgery on animsition.js source nice results.

if take @ line 66 (in current state) you'll see animsition binding link clicks , inserting animation.

$(options.linkelement).on("click." + namespace, function(event) {   ... } 

if instead use little javascript event delegation can "bind anchors/links on page , in future". like...

$("body").on("click." + namespace, options.linkelement, function(event) {   ...         }); 

this hack on end i'm going go later (when i'm not under gun on project) proper fork, test, pull request, etc , try main project. hope works , else though.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -