lundi 30 mai 2016

Can't access iframe contents and hover on divs

i am trying to access iframe with jquery at the same domain eg current site url: http://example.com

Platform:wordpress plugin

 <iframe id="mmIframe" src="http://example.com"></iframe>

I tried this but not working:

var $j = jQuery.noConflict();
$j(document).ready(function(){
           'use strict';

               $j("#mmIframe").contents().find(".logo").hide(); 

               $j("#mmIframe").contents().find("div").hover(
                 function() { $j(this).addClass("mm-Hover"); },
                 function() { $j(this).removeClass("mm-Hover"); }
                );


});

I have <div class="logo"></div> inside my iframe.

I dont have any error's in developer console and i set allow origin to be sure its not the issue.

How i access iframe and hover inside contents?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire