Results 1 to 3 of 3

Thread: Image Thumbnail Viewer, slower fade.

  1. #1
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Image Thumbnail Viewer, slower fade.

    1) Script Title: Image Thumbnail Viewer

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm

    3) Describe problem:
    Thank you for a nice script. Excactly what i've been looking for, for about 4 hours yesterday

    I have one question/wish.
    Can you either change the javascript file, so when you click the image, it will open/fade in a bit slower. Like a sec or so?

    Or combine it with jquery?

    I have looked at Image Thumbnail Viewer 2, but I don't like that it dosn't closes the image again when you click it... Image Thumbnail Viewer 1 is perfekt for me.

  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

    Find this function in the thumbnailviewer.js script (around line #45):

    Code:
    showthumbBox:function(){ //Show ThumbBox div
    thumbnailviewer.thumbLoading.style.visibility="hidden" //Hide "loading" div
    this.centerDiv(this.thumbBox)
    if (this.enableAnimation){ //If fading animation enabled
    this.currentopacity=0.1 //Starting opacity value
    this.opacitytimer=setInterval("thumbnailviewer.opacityanimation()", 20)
    }
    },
    See the highlighted line and the red number. This is the number of milliseconds between each step in the fade in animation for this script. Increase that number to - say, 40 or 60. Much higher than that would probably be too slow or too choppy.

    This is different than jQuery, where a number like this would set the duration of the effect. This number sets the duration of each step of the effect. So it should be smaller than a jQuery duration figure by a factor of 10 (there are about 10 steps in this animation).

    If you want to increase the number of steps, go here (around line #94):

    Code:
    opacityanimation:function(){ //Gradually increase opacity function
    this.setimgopacity(this.currentopacity)
    this.currentopacity+=0.1
    if (this.currentopacity>1)
    this.stopanimation()
    },
    Setting that number to - say 0.05, will get you about twenty steps. That will also slow things down, and perhaps more smoothly than increasing the amount of time between steps will. Ideally this number should divide evenly into 1, and that result will be the approximate number of steps for the animation.

    You may find it best to play with both numbers a bit before you get what you want.
    Last edited by jscheuer1; 08-06-2011 at 02:55 PM. Reason: add detail
    - John
    ________________________

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

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Smasher (08-07-2011)

  4. #3
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much

    I have actually played with those excact numbers, but I changed them to something like 1000, which with jquery is 1000ms=1 sec. So nothing really happened, lol.

    Number 30
    And 0.03
    Seems to be perfect for me

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
  •