Results 1 to 5 of 5

Thread: Open iframe from link, then make it draggable

  1. #1
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Open iframe from link, then make it draggable

    Alright, having an issue here. I'm not huge on this stuff, but its relatively self explanatory (plus i just cut and paste) but im working on basically having a link that will open up an iframe window on the page. After that the iframe should be draggable by a table based on the ID of the table (source is available at http://www.mattkruse.com/javascript/dragiframe/). The problem that I'm having is that the iframe opens up fine, all the information is correct, and the draggable mouse icon appears when it goes over the table, but it doesn't drag at all. I can't seem to figure it out no matter how much I tinker with it. The function to add the iframe is as follows.
    Code:
    function addIframe () {
      if (document.all)
        document.body.insertAdjacentHTML('beforeEnd',
          '<iframe id="datamain1" name="datamain1" src="iframe3.html" width=180 height=730 scrolling=no allowtransparency="true" background-color="transparent" ><\/IFRAME>');
    Any help would be greatly appreciated! thanks in advance!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Where did you put the code to make the iframe dragable? On the parent page or on the page inside the iframe? Your example page is unavailable (404) at the moment. Have you tried:

    DHTML Window

    That is essentially a dragable iframe, all the rest is just added images and links that you can get rid of if you don't want them.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, added in a ) in the link. There is simply a line you put in the body code of the iframe document. The page is http://www.mattkruse.com/javascript/dragiframe/ . That should work, like i said i just had the ) at the end (oops). Then also you simply load the dragifram.js with the <script> commands in the body document. It works fine with pages when the iframe isn't generated through the addiframe function, but after I load the iframe, its not draggable. Again, the cursor shows like it should be draggable, but doesn't let me drag. Weird, and I don't know why it wouldn't work since i'm just adding in the code through the function to the end of the document when you click the link. Everything else works...

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I couldn't find any iframes on that page that weren't dragable to some extent. Some problems do appear to be occurring though. One is that sometimes the iframe slips away and can become difficult or impossible to acquire again. Other times, if the iframe is acquired, it is difficult to let go. Iframes may be dragged outside the actual confines of the page (causing the page to grow in one or more dimension(s). It also seems as though there is sometimes bleed through from one iframe to the other when one is dragged it seems to move another or others as well. Some of these problems may just be artifacts of others or one other. The main problem is, as I see it, that any given iframe may be dragged beyond the original dimensions of the page that it is showing through onto. Since those dimensions and boundaries could be acquired from the code on the iframe pages, they should be established and limits set using them as to how far the iframe may be dragged off of the page. I vote for no portion of a dragable iframe being allowed to cross the edges of the parent page. I'd also vote for not dynamically adding a dragable iframe element to a page if, by doing that, you cause the page's original dimensions to change.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Alright, theres certain ways to fix the problems you present... but thats not really the point. And theres a way to make it so you can't drag it off the page :
    Code:
    // Set to true to allow IFRAME objects to be dragged off the screen. This may
    // make the handle be no longer reachable by the mouse, causing the IFRAME to
    // be stranded.
    // Defaults to false
    allowDragOffScreen(true|false);
    Well you vote for not doing it the way I want it done :P hehe, doesn't seem too promising then. So then there isn't a way to do it, or it will simply be quirky (i like quirky!).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •