5

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/

Ivan
  • 385
  • 3
  • 5
  • 14
  • Works in Firefox at least – DGS Sep 01 '13 at 09:44
  • http://jsfiddle.net/77van/k8GhZ/10/ now it works , i reload the iframe with jquery , source: http://stackoverflow.com/questions/4249809/reload-an-iframe-with-jquery – Ivan Sep 01 '13 at 09:48

2 Answers2

6

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/

Arturs
  • 1,258
  • 5
  • 21
  • 28
Ivan
  • 385
  • 3
  • 5
  • 14
  • 1
    You should do it like this so the jQuery call is being "cached" https://gist.github.com/fedmich/8947380 – fedmich Feb 12 '14 at 00:25
2

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

Maverick
  • 478
  • 1
  • 3
  • 13