This question has already been answered:
jQuery.ScrollTo scrolling rewind is called by this script:
jQuery(document).ready(function(){ jQuery('.bp-pager').click(function() { jQuery.scrollTo('#wrapper'); }); });
But after the ajax load occurs, it stops working. I read that I need to add an event handler, but I don’t understand how to write it correctly.
I tried it like this
jQuery(document).ready(function(){ jQuery('.bp-pager').live("click", function(){ jQuery.scrollTo('#wrapper'); }); });
generally stopped working.
Answer:
$('.db_wrapper').on('click', '.bp-pager', function(){ jQuery.scrollTo('#wrapper'); });
.db_wrapper is a block that wraps content loaded by ajax.
Dmitry helped with the decision only with the body did not work.
ajax
is related to the problem. Most likely,ajax
request loads html content that replaces the original html, on which you install theclick
event handler. Try this withjQuery('body').on("click", ".bp-pager", function(){ jQuery.scrollTo('#wrapper'); });
- Dmitry