+ Reply to Thread
Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Help with draggable layers javascript

  1. #21
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: Help with draggable layers javascript

    sorry for the late reply, but if this is still a problem, perhaps this could be helpful http://www.quirksmode.org/js/dragdrop.html

  2. #22
    Teensweb is offline x10 Lieutenant Teensweb is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    352

    Re: Help with draggable layers javascript

    No I was not looking for the lightbox, I made my own popup window and it works fine, the prblem was only with dragging it now that's fixed too. I added a mouse trap as misson said and instead of adding event listener and all those thingummy, i just made my way with
    HTML Code:
    <!DOCTYPE html PUBLIC"-// W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style type="text/css">body{margin:0px;overflow:hidden;}iframe.c1{position:absolute;top:0px;z-index:0;overflow:visible;height:100%;width:100%}
        </style>
        <title>  </title>
        <style type="text/css">#player{position:absolute;z-index:100;height:250px;width:192px;}#f{position:absolute;height:249px;width:192px;left:1px;z-index:100;top:26px;}#c{position:absolute;z-index:110;height:250px;width:192px;cursor:move;}
        </style>
      </head>
      <iframe id="frame" src="http://blog.cyberflare.co.cc/index.php" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" class="c1" name="frame">
      </iframe>
      <div id="player" style="display:none;visibility:hidden;top:0;left:0">
        <div onmousedown="dragOBJ(document.getElementById('player'),event);fhide('hidden');return false" onmouseup="fhide('')" id="c">
          <img alt="" src="m.png">
          <img alt="" style="position:absolute;right:7px;top:7px;z-index:100;cursor:pointer" src="min.png" onclick="ftoggle('player')">
        </div>
        <iframe id="f" scrolling="no" frameborder="0" src="http://google.com">
        </iframe>
      </div>
    </html>
    and the js
    Code:
    $(v);
       {return (document.getElementById(v));
       }
    
    function agent(v)
       {return (Math.max(navigator.userAgent.toLowerCase().indexOf(v), 0));
       }
    
    function xy(e, v)
       {return (v ? (agent('msie') ? event.screenY + document.body.scrollTop: e.pageY): (agent('msie') ? event.screenX + 
          document.body.scrollTop: e.pageX));
       }
    
    function dragOBJ(d, e)
       {
       function drag(e)
           {if ( ! stop)
               {d.style.top = (tX = xy(e, 1) + oY - eY + 'px');
                d.style.left = (tY = xy(e) + oX - eX + 'px');
               }
            return false;
           }
        var oX = parseInt(d.style.left), oY = parseInt(d.style.top), eX = xy(e), eY = xy(e, 1), tX, tY, stop;
        document.onmousemove = drag;
       
        document.onmouseup = function()
           {stop = 1;
            document.onmousemove = '';
            document.onmouseup = '';
           };
       }
    
    function ftoggle(id)
       {document.getElementById(id).style.display = "";
        if (document.getElementById(id).style.visibility == "hidden")
           {document.getElementById(id).style.visibility = "";
           }
        else document.getElementById(id).style.visibility = "hidden";
       }
    
    function fhide(s)
       {document.getElementById('f').style.visibility = s;
       }
    I added a division mtrap and worte a function to push up its z-index on clicking the drag-bar
    here's the and added the following as the mousetrap division:
    HTML Code:
    <div onmouseup="fhide('',-10)" onmouseover="dragOBJ(document.getElementById('player'),event);return false" id="mtrap"></div>

  3. #23
    Teensweb is offline x10 Lieutenant Teensweb is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    352

    Re: Help with draggable layers javascript

    The issue seems to have been fixed, someone may close this thread, thanx for the help.

+ Reply to Thread
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Need some javascript help
    By Christopher in forum Programming Help
    Replies: 18
    Last Post: 07-07-2008, 08:57 AM
  2. CSS or Javascript?
    By kkenny in forum Programming Help
    Replies: 4
    Last Post: 06-22-2008, 01:32 AM
  3. javascript and external javascript files problem
    By delon in forum Programming Help
    Replies: 6
    Last Post: 04-27-2008, 12:41 AM
  4. My Draggable Divs Script
    By VPmase in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 04-13-2008, 12:58 PM
  5. Blending layers together
    By Matthews255 in forum Graphics & Webdesign
    Replies: 6
    Last Post: 04-15-2005, 02:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers