Results 1 to 7 of 7

Thread: CMotion - Skip to start/end/middle

  1. #1
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CMotion - Skip to start/end/middle

    1) Script Title: CMotion Image Gallery

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...iongallery.htm

    3) Describe problem: Love this script & it's working really well. Would like to add to it but my javascript knowledge just isn't up to the task.

    As I'm using it to display full size images rather than thumbnails & there are quite a few images in the gallery it would be nice to offer the ability to skip to the begining/end/middle of the gallery.

    Since the startpos variable is already set up & I'd basically just be wanting to allow the user to set that is this a fairly easy task?

    Thanks in advance for any help/responses.

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

    from the Demo Page:
    Image train may be started left, center or right.
    From motiongallery.js -

    Code:
     //1) Set width of the "neutral" area in the center of the gallery.
    var restarea=6;
     //2) Set top scroll speed in pixels. Script auto creates a range from 0 to top speed.
    var maxspeed=7;
     //3) Set to maximum width for gallery - must be less than the actual length of the image train.
    var maxwidth=1000;
     //4) Set to 1 for left start, 0 for right, 2 for center.
    var startpos=0;
     //5) Set message to show at end of gallery. Enter "" to disable message.
    var endofgallerymsg='<span style="font-size: 11px;">End of Gallery</span>';
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    As I mentioned, I found that variable, what I'm hoping to do though is to use it to allow people browsing the site to skip around the gallery...

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

    I didn't get that, sorry. Yes, you can jump around the various starting positions fairly easily:

    HTML Code:
    <span onclick="startpos=0;onresize();">Jump to Beginning</span>
    For the two other positions - use 1 for the end, 2 for the center.

    You can also pick your own custom spots in the image train by doing:

    Code:
    onclick="onresize();cross_scroll.style.left='-100px';"
    Use whatever number you like, it represents the number of pixels from the starpos=0 point that you want your image train to assume.
    - John
    ________________________

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

  5. #5
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you That was exactly what I was looking for.

    Works in Firefox... can't seem to get it to work in IE though, any clue why?

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

    Darn that IE, always has to be different. A call to onresize(); in the script works just fine but, as an onclick event doesn't. There is an easy enough way around it though. Change this in the script:

    Code:
    onresize=function(){
    to:

    Code:
    function cresize(){
    and below that function, put this (red):

    Code:
    function cresize(){
    if (typeof motioncontainer!=='undefined'&&motioncontainer.filters){
    motioncontainer.style.width="0";
    motioncontainer.style.width="";
    motioncontainer.style.width=Math.min(motioncontainer.offsetWidth, maxwidth)+'px';
    }
    menuwidth=crossmain.offsetWidth;
    cross_scroll.style.left=startpos? (menuwidth-actualwidth)/startpos+'px' : 0;
    }
    onresize=cresize;
    Now you can use this:

    Code:
    <span onclick="startpos=0;cresize();">Jump to Beginning</span>
    and similar to do this for all browsers that support the gallery.
    - John
    ________________________

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

  7. #7
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much, you're an absolute star!!!

    That works perfectly.

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
  •