I have a one-page scrolling webpage which, using jQuery, attaches a class to the body depending on which 'page' is being viewing. For example, scrolling to the third page adds
<body class="main-viewing-page-2">
.
This is how I call my animation on elements for these pages, when the user scrolls to that 'page' the class changes and my animation runs. I have achieved this by using the css:
.main-viewing-page-2 #whatevertheelement {
-webkit-animation: fadeInUp 0.5s;
animation: fadeInUp 0.5s;}
(I'm not sure if this is the most effective way to do this but it seems to work, any advice appreciated!)
On the third 'page' I have an iFrame. This is on the same domain and completely controlled by me.
I need to be able to trigger animation on a div inside the iFrame when the parent container has the class <body class="main-viewing-page-3">
.
I'm not sure how to make the iFrame 'listen' for when the class is created in the parent. I have tried to use the css below but it doesn't work.
.main-viewing-page-3 #iframediv {
-webkit-animation: fadeInUp 0.5s;
animation: fadeInUp 0.5s;}
I have seen reference to $("#myid", top.document);
but I'm not sure how to implement this.
I'm a bit of a novice so apologies in advance.