Link to home
Start Free TrialLog in
Avatar of badwolfff
badwolfffFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How do I animate a div inside an iframe using Jquery?

I have a main page and on it I have a button and an iframe. Inside the iframe I have an external html page with a div on it. Using the button on the main page how do I animate the div inside the iframe?

I have tried something like this:
$(document).ready(function(){
      $("a").click(function(){
            $("#iFrameID").contents().find("#divID").animate({"top": "-450px"},{ queue:false, duration:800, easing:"quartEaseInOut"});
      });
});


This does not work. Could anyone show me how to fix this code?
I am attaching a test project here. test.zip
Avatar of micma18
micma18

You can reload the iframe, with some parameters, for it to animate. <iframe src='externalpage.html?animate=1'>

and ofcourse make the externalpage.html, trigger the script on the GET animate = 1
Avatar of badwolfff

ASKER

sorry could you please illustrate with an example?
I didn't really understand your explanation.
ASKER CERTIFIED SOLUTION
Avatar of badwolfff
badwolfff
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial