Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery setting .attr to an iframe scrolling=yes

I have an iframe with "scrolling="no"" and a button that sets iframe attribute to scrolling="yes", when it's needed.

    $("#button3").click(function(){
    $( "#iframe_id" ).attr( "scrolling", "yes" );});    

But the scroll bar doesn't appear, when i press the button3, only after i refresh the iframe. How to force the srcoll bar appear instantly?

How it works now: http://jsfiddle.net/77van/k8GhZ/1/

like image 349
Ivan Avatar asked Sep 01 '13 09:09

Ivan


2 Answers

Now jquery sets .attr to scrolling="yes" and reloads the iframe!

$(document).ready(function () {
    $("#button3").click(function () {
        $("#iframe_id").attr("scrolling", "yes");
        $('#iframe_id').attr("src", $('#iframe_id').attr("src"));
    });
});

http://jsfiddle.net/77van/k8GhZ/10/

like image 126
Ivan Avatar answered Nov 04 '22 15:11

Ivan


Trust me, there is no way you can do it with iframe. It will not work in Chrome or IE. I have played a lot with iFrame in past and such things never worked for me.

iFrame simply doesn't accept any changes, after it's loaded

like image 39
Maverick Avatar answered Nov 04 '22 17:11

Maverick