2

I can't find any draggable, resizable and movable iframe on the web. Can anybody help? jQuery would be better.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
ammar
  • 1,373
  • 4
  • 11
  • 13

1 Answers1

4

This isn't a jQuery solution, but it seems to work: http://www.mattkruse.com/javascript/dragiframe/

or if you really want jquery, you could wrap the iframe inside a draggable/resizable div.. like this: http://jsfiddle.net/7uTTs/

Filip Cornelissen
  • 3,682
  • 3
  • 31
  • 41
  • Im not super familiar with the drag and resize functions of jquery but i cant help but wonder if its just how it works or is it the way you did it.. or just the way it works with iframe.. but it doesnt respond well towards quick movements while resizing or dragging. – Joonas Jul 06 '11 at 10:37
  • That's lag because of the iframe. If you delete the iframe, there is no lag.. http://jsfiddle.net/7uTTs/3/ – Filip Cornelissen Jul 06 '11 at 14:46
  • So it is just how it acts with iframe.. Ok, then i would probably hide iframe. For example something like this ( edit: added mouseleave to bulletproof the fadeIn incase of releasing outside browser.. etc http://jsfiddle.net/7uTTs/5/ ) So that when youre performing dragging or resizing it wont get cut off by iframe. I dont think that would even be super confusing for visitors either.. Another idea i had was to put overlay on top of iframe on mousedown.. – Joonas Jul 06 '11 at 15:33
  • actually http://jsfiddle.net/7uTTs/4/ is still kinda better as i noticed that fast movements cause the iframe to fade back in.. :) But.. With number 4 Clicking the orange frame will bring the iframe back incase it is lost.. – Joonas Jul 06 '11 at 15:39
  • I think that maybe takes a few step back on the whole idea dont you think? as you cant navigate iframe in anyway... – Joonas Jul 07 '11 at 09:28
  • well, it depends on what you want to do with the iframes :) but i guess there is enough discussed on this topic now.. – Filip Cornelissen Jul 25 '11 at 14:42
  • If you don't want to fade in and out, there is an alternative: https://stackoverflow.com/a/22306056 – user185953 Jan 19 '21 at 16:16