SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member
    Join Date
    Jul 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drag div with background image without showing hourglass.

    Hi,
    I am in a problem. May u help me.
    The problem is:
    When I drag a div with background image in IE it showing hourglass icon.
    Is it possible in IE to drag a div with with background image without showing hourglass icon. Please help me.

    dragdrop.htm
    Code:
    <html>
    <head>
    <title>Drag And Drop</title>
    <style>
    <!--
    .dragme{
    position:relative;
    }
    -->
    </style>
    <script language="javascript" src="draganddrop.js"></script>
    </head>
    <body>
    
    
             
              <div class="dragme" id="c2"  title="images/draganddrop/2.jpg" style="background: url('images/draganddrop/2.jpg');height:100;width:100;border: 1px solid #000000 "></div>
    
    </body>
    
    </html>
    dragdrop.js

    Code:
    var ie=document.all;
    var nn6=document.getElementById&&!document.all;
    
    var isdrag=false;
    var x,y;
    var dobj;
    var ihtml,ihtm;
    
    function movemouse(e)
    {
      if (isdrag)
      {
        dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
        dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
        return false;
      }
    }
    
    function selectmouse(e)
    {
      var fobj       = nn6 ? e.target : event.srcElement;
      var topelement = nn6 ? "HTML" : "BODY";
    
      while (fobj.tagName != topelement && fobj.className != "dragme")
      {
        fobj = nn6 ? fobj.parentNode : fobj.parentElement;
      }
    
      if (fobj.className=="dragme")
      {
        isdrag = true;
        dobj = fobj;
        tx = parseInt(dobj.style.left+0);
        ty = parseInt(dobj.style.top+0);
        x = nn6 ? e.clientX : event.clientX;
        y = nn6 ? e.clientY : event.clientY;
        document.onmousemove=movemouse;
        return false;
      }
    }
    
    document.onmousedown=selectmouse;
    document.onmouseup=new Function("isdrag=false");
    
    
    function Opac(obj,val)
    {
    
     if(val==10){
      ihtml=obj.style.background;
      obj.style.background='';
     }
     else
    {
     alert(ihtml);
     obj.style.background=ihtml;
     }
    
     if (document.all)
       obj.style.filter = 'alpha(opacity='+val+')';
     else if (document.getElementById)
       obj.style.MozOpacity = val+'%';
     return false;
    }

  2. #2
    SitePoint Wizard bronze trophy bluedreamer's Avatar
    Join Date
    Jul 2005
    Location
    Middle England
    Posts
    3,361
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Correct me if I'm wrong but it's the operating system that displays the hour glass?

  3. #3
    Non-Member
    Join Date
    Jul 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bluedreamer
    Correct me if I'm wrong but it's the operating system that displays the hour glass?
    Hi
    Thanks for your reply.
    I realy want that, when i'll drag a div (with background image) move smoothly ( as in FireFox). But the problem is in case of IE. Moving but not smoothly, It showing busy icon (hourglass). I have tried it in many ways but failed.


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
  •