Friends, My issue is that my page is really slow to load, because all of the load simeltaneously. I am pulling an RSS feed that if you click on the "article" button it will pop up a Modal that has the inside of it. The problem is that all of the s load simeltaneously.
here is the site: http://daisy.camorada.com/
I have tried inserting a src into the but that doesn't work because i guess the iframe loads when the page opens.
<button class='btn btn-primary' id='miguel'>TEST ME NOW</button>
<button class='btn btn-primary' id='jamison'>jamison</button>
<div id="yoyoyo">
</div>
<iframe id="gogo">
</iframe>
<script>
$('#miguel').on('click', function() {
alert('clicked');
$('#gogogo').attr('href', 'http://www.google.com');
});
</script>
<script>
$('#jamison').on('click', function() {
alert('clicked JAMISON');
$("#yoyoyo").html("<h1>HELLO J</h1><br><iframe class='full-iframe' href='http://news.yahoo.com/three-killed-tribal-clash-libya-001717827.html'></iframe>");
});
</script>
The most direct way to do what you want is to have your server give you a complete page that only contains the fragment you want to show. As an alternative, you could just use a simple <div> and use the jQuery load function to load the whole page and pluck out just the section you want: $('#target-div').
Iframes Bring Security Risks. If you create an iframe, your site becomes vulnerable to cross-site attacks. You may get a submittable malicious web form, phishing your users' personal data. A malicious user can run a plug-in.
Find there an insert “Add new PopUp” and choose Iframe template. Type the name of future Popup and click the button “Save”. Go to Design tab -> Appearance -> find “IFrame URL” field. Copy and paste here URL of site, that you need to display in PopUp as iFrame.
<a href="http://example.com" target="myiFrame">Click me!</a>
<iframe name="myiFrame" src="about:blank">
No JavaScript required.
Html:
<iframe id="myiFrame" data-src="http://my.url" src="about:blank">
</iframe>
In your jQuery:
$("button").click(function(){
var iframe = $("#myiFrame");
iframe.attr("src", iframe.data("src"));
});
Or if you wanted to load ALL iframes when you click one button... make sure they all have a data-src="your.url"
attribute, and then loop through like this:
$("button").click(function(){
$("iframe").each(function(){
$(this).attr("src", $(this).data("src"));
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With