Results 1 to 10 of 10

Thread: Image Pan Script (DOM Drag & Drop)

  1. #1
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Image Pan Script (DOM Drag & Drop)

    Hey, I' trying to make an image panning script. I've used the DOM Drag & Drop script.

    And this is what I've managed to do:
    http://www.scrin.nl/imagepan/index.html

    It is almost finished, but there are some bugs.

    1. If you go the the image pan page for the first time in a browsing session in Firefox, the image isn't dragable.

    2. In IE6 you can see the whole image, it overlaps the box.

    In Opera it's working fine.

    Can someone help me with this? The whole code you can find in the source.

  2. #2
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    How about using a div with a background image instead of a whole image element?

  3. #3
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yea, but that a good idea, thanks. But how can I use different images without changing the file?

  4. #4
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What do you mean use different images without changing the file? Which file? Which images?

  5. #5
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, I was unclear in explaining.

    Now the imahe height and width are automatically get by javascript. If I want an other image I just change the src of the IMG tag.

    If I use a div with the image as a background, wich solves the problem I have, but a DIV can't adept to the height and width of his background image. Then I have to set the panX and panY manually.

  6. #6
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Alright, so. First thing, it's a cache problem.
    Second, the Drag.init script is called as soon as the script is loaded, however the image isn't thus you can't see the imageWidth and imageHeight on first load(displays 0).

  7. #7
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    SO I have to load the image before Drag.init executes. Would a preloader work?

  8. #8
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes you have to preload the images before the script gets called OR you have to call the script after the image has loaded. A perloader? What preloader?

  9. #9
    Join Date
    Aug 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I mean an image preloader.

  10. #10
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Do whatever you want, my job was to tell you the problem.

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
  •