![]() |
A link on click call and animate div of another page using jquery
hello,
i have link in one page and on click on link i want to animate div which is inside another page. i am using following code but it is not working. $('#home').click(function() { $('html, body').animate({ scrollTop: $("#f1 #one").offset().top },2000); }); another page is called in iframe. #f1 is the iframe's id and #one is div's id. i want if anyone click on home link #one should be animated and scroll to top using jquery. please reply me soon. |
Code:
$('#home').click(function() { |
i have added the code. but it's not working.
let me know if there is any other way for that. |
i have searched on google and written following code in another page which is inside iframe :
$(parent.document,'#home').click(function() { $('html, body').animate({ scrollTop: $("#one").offset().top }, 2000); }); $(parent.document,'#compn').click(function() { $('html, body').animate({ scrollTop: $("#four").offset().top }, 2000); }); $(parent.document,'#srv').click(function() { $('html, body').animate({ scrollTop: $("#two").offset().top }, 2000); }); now it is animating, but still not animating properly. it animates whole page twice and then stuck on one position only. can anyone help me for that? |
| All times are GMT +1. The time now is 12:55 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.