andyd34 Posted January 15, 2013 Share Posted January 15, 2013 I'm playing around with things in phpbb and am adding jQuery to a lot of things. With a few of the pages i'm putting them in modal windows just for convenience really. I tried loading the faq.php into a modal window and everything was great until i tried using the scroll function, the problem is when the page is loaded normally everything works but when its loaded inside the modal div its scrolling the parent page. I cant post a link as its on my testing server on my local network but here is the code to scroll to the answer $("#f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}").click(function(){ $('html, body').animate({scrollTop:$("#l{faq_block.S_ROW_COUNT}_{faq_block.faq_row.S_ROW_COUNT}").offset().top}, 2000); return false }); and the back to top link is $("#a{faq_block.S_ROW_COUNT}_{faq_block.faq_row.S_ROW_COUNT}").click(function(){ $('html, body').animate({scrollTop:$("#faqtop").offset().top}, 2000); return false }); like i said when the page is loaded normally it works great but when loaded inside the div it isnt scrolling the page inside the div its scrolling the main page Any suggestions would be gratefully appreciated Thanks Quote Link to comment https://forums.phpfreaks.com/topic/273217-jquery-scroll-issue/ Share on other sites More sharing options...
Adam Posted January 16, 2013 Share Posted January 16, 2013 That's because you're animating the "html, body" selector, not the modal window. Quote Link to comment https://forums.phpfreaks.com/topic/273217-jquery-scroll-issue/#findComment-1406153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.