Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    Post your code so i can see whats going on.

    Thread Starter andrezasv

    (@andrezasv)

    Here is the code. I have a tab plugin within the modal and each tab has an iframe. So, at first time when I open the modal it is ok, but if I close the modal and open again it shows the iframe for some miliseconds and after it loads the iframe.

    [modal id=Test height=500 width=1000]
    
    [tabs title="" disabled="false" collapsible="true" active="0" event="click"]
    [tab title="Title of Tab 01"]<iframe onload='changeCssIFrameTodasPaginas();' id='iFrameTodasPaginas' width='1000' height='500'></iframe>[/tab]
    [tab title="Title of Tab 02"]<iframe onload='changeCssIFrameAddPagina();' id='iFrameAddPagina' width='1000' height='500'></iframe>[/tab]
    [/tabs]
    
    [/modal]  
    
    <script> function urlChange() {
    	var iFrameTodasPaginas = document.getElementById('iFrameTodasPaginas');
    	var iFrameAddPagina = document.getElementById('iFrameAddPagina');
    	iFrameTodasPaginas.src = 'site1.html';
    	iFrameAddPagina.src = 'site2.html';
    }
    </script>
    
    <script>
    function changeCssIFrameTodasPaginas() {
    	var iframeElement = document.getElementById('iFrameTodasPaginas');
    	var cssLink = document.createElement("link");
    	cssLink.href = "iframe.css";
    	cssLink.rel = "stylesheet";
    	cssLink.type = "text/css"; 
    
    	var iframeContent = (iframeElement.contentWindow || iframeElement.contentDocument);
    	if (iframeContent.document)
    		iframeContent = iframeContent.document;
    	iframeContent.getElementsByTagName('head')[0].appendChild(cssLink);
    }
    
    function changeCssIFrameAddPagina() {
    	var iframeElement = document.getElementById('iFrameAddPagina');
    	var cssLink = document.createElement("link");
    	cssLink.href = "https://wordpress9.hospedagemdesites.ws/wp-content/iframe.css";
    	cssLink.rel = "stylesheet";
    	cssLink.type = "text/css"; 
    
    	var iframeContent = (iframeElement.contentWindow || iframeElement.contentDocument);
    	if (iframeContent.document)
    		iframeContent = iframeContent.document;
    	iframeContent.getElementsByTagName('head')[0].appendChild(cssLink);
    }
    </script>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Iframe in the Modal’ is closed to new replies.