Results 1 to 2 of 2

Thread: Dom Drag and Drop error

  1. #1
    Join Date
    Sep 2008
    Location
    Southern California
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dom Drag and Drop error

    1) Script Title: DOM Drag & Drop Script

    2) Script URL (on DD): DOM drag and drop

    3) Describe problem: I can't seem to get the drag end coordinates to work in a simple if statement. Do I have bad syntax or something? Here is my code:

    Code:
    var fdThumb = document.getElementById("fd");
    Drag.init(fdThumb, null, 0, 720, 0, 315);
    fdThumb.onDragEnd = function(x, y)
    if(x <= 720 && x >= 670 && y <= 160 && y >= 30){
    	alert('x: ' + x + ' y: ' + y);//just to see if it works
    }
    When I just have the code without the if statement:
    Code:
    var fdThumb = document.getElementById("fd");
    Drag.init(fdThumb, null, 0, 720, 0, 315);
    fdThumb.onDragEnd = function(x, y)
    alert('x: ' + x + ' y: ' + y);//just to see if it works
    it works fine, so I am thinking maybe I have a syntax error or something.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    There may be other errors from code you haven't posted, but just based on it, the code in red is missing:

    Code:
    var fdThumb = document.getElementById("fd");
    Drag.init(fdThumb, null, 0, 720, 0, 315);
    fdThumb.onDragEnd = function(x, y){
    if(x <= 720 && x >= 670 && y <= 160 && y >= 30){
    	alert('x: ' + x + ' y: ' + y);//just to see if it works
    }
    }
    DD Admin

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
  •