Page 1 of 5 123 ... LastLast
Results 1 to 10 of 50

Thread: CMotion Image Gallery script

  1. #1
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Red face CMotion Image Gallery script

    http://www.dynamicdrive.com/dynamici...iongallery.htm

    The problem I'am having is that instead of stopping at the ends I want the gallery to continiously roll through over and over again through the gallery:

    Ie: when the last image on the right side appears I want to see the first image re-appear right beside it and keep on rolling through infinite times. This is exactly the script I need for a site Iam making at

    http://silentcivilian.net.tc because it would fir the concept of the java applet menu I have there.

  2. #2
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    *bump*

  3. #3
    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

    This one was a little tough, see Demo. Right click to view source. For purposes of development, I put the code and style on the same page as the HTML. If you need help making them external again, let me know, it is easy to do.
    - John
    ________________________

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

  4. #4
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    That is very almost exactly what I need, I really appreciate the help. The last thing thing is for it to begin scrolling when the page loads, even if the mouse is off of it. But when the visitor mouseovers the gallery than it functions exactly as it does in your modification (scrolling left or right depending on the position of the cursor) and continue scrolling after the visitor mouses off the gallery.

  5. #5
    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

    That's easy enough to add. Near the end of the script, where it says:
    Code:
    }
    loadedyes=1
    }
    window.onload=fillup
    </script>
    Add to it like so:
    Code:
    }
    loadedyes=1
    scrollspeed=2
    moveleft()
    }
    window.onload=fillup
    </script>
    The number 2 for scrollspeed can be increased or decreased for a faster or slower initial scroll. The call for 'moveleft()' can be changed to 'moveright()' if you prefer. Then, to keep it scrolling onmouseout, find the function:
    Code:
    function stopmotion(e){
    if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){
    if (window.lefttime) clearTimeout(lefttime)
    if (window.righttime) clearTimeout(righttime)
    movestate=""
    }
    }
    Change it to this:
    Code:
    function stopmotion(e){
    if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){
    scrollspeed=2
    }
    }
    Once again, if you want it to be scrolling faster or slower than 2 when the mouse is not over it, set the scrollspeed here accordingly. It would probably be best to use the same value for scrollspeed here as above.
    - John
    ________________________

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

  6. #6
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    Excellent! it is working perfectly now.
    I thank you for all your help!

  7. #7
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    Also how would I get the onmouseout scrolling effect to be the same speed as it was at the last instant my mouse was over the gallery? As of now it goes back to "2" when I move my cursor away from the gallery but say I have my cursor positioned over the far left side of the gallery (where it is scrolling fast) and I mouseout and I want it to continue scrolling at that speed; as I would if I had my cursor positioned only halfway to the side where it is going a bit slower and I mouseout of the gallery so then presumebly the automatic scrolling would retrieve the variable of speed from the last onmouseover is what I guess Iam trying to say.

    I have the script set up at www.silentcivilian.net.tc just click the flag and youll see the mod.

    Many thanks
    ~Spinethetic

  8. #8
    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

    When modding a script to someone's request, I usually consider what would be reasonable. I thought continuing at the current speed unreasonable because it would look bad, in my opinion, to leave it scrolling at 'lightning speed' (in the case you mention) with the mouse on other content. If that is the way you want to go, just substitute:

    return;

    for

    scrollspeed=2

    in the stopmotion(e) function.
    - John
    ________________________

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

  9. #9
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    It is already set up with 'scrollspeed=2' which is how I wanted it but if I have my cursor on the far left side of the gallery you can see that it scrolls a litle faster than it would if my cursor was say, 50px to the right (the further to the left/right the faster the gallery scrolls, if your cursor is towards the center the slower it scrolls)

    What Iam trying to do is say I have my cursor positioned so that the gallery is slow scolling and I move my curosr up the page, therefore onmouseout, I would want the gallery to continue scrolling at that speed it was the last time I put my cursor over it; in the same instance lets say I decide to move my cursor down the page again backonto the gallery, but this time to the far side, therefore causing the gallery to scroll relatively fast and then I remouseout and I would want the gallery scrolling at that speed.

    I think the easiest way would be when the cursor is over the gallery is to then send the speed variable to the stopmotion(e) function so that it would continue scrolling at the speed of last mouseover.

  10. #10
    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

    Did you try my suggestion, or even understand it? You don't have to send anything to the stopmotion(e) function, the speed is already set. I added the scrollspeed=2 to make it seem reasonable to me. If you want the speed to maintain onmouseout, just change 'scrollspeed=2' to 'return;' in the stopmotion(e) function, as I said in my last post.
    - John
    ________________________

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

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
  •