Results 1 to 3 of 3

Thread: Ultimate Fade-in slideshow - help with image size

  1. #1
    Join Date
    Oct 2011
    Location
    Louisville, KY
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Ultimate Fade-in slideshow - help with image size

    1) Script Title: Ultimate Fade-in slideshow

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

    3) Describe problem: Hi there. First off, thanks for publishing such a great script! I however have a problem I'd like to solve. I have rather large photos I'd like to put into this slideshow, but I'd like the box to remain the size specified in the code. Here's what I've found so far:

    There's this code starting at line 138:
    Code:
    var imgdimensions=[$slideimage.width(), $slideimage.height()] //center align image
    $slideimage.css({marginLeft: (imgdimensions[0]>0 && imgdimensions[0]<setting.dimensions[0])? setting.dimensions[0]/2-imgdimensions[0]/2 : 0})
    $slideimage.css({marginTop: (imgdimensions[1]>0 && imgdimensions[1]<setting.dimensions[1])? setting.dimensions[1]/2-imgdimensions[1]/2 : 0})
    I can hard-code the width and height by changing line 138 to this:
    Code:
    var imgdimensions=[$slideimage.width(250), $slideimage.height(180)] //center align image
    ...but that doesn't work if I have an image that doesn't match those ratios exactly (i.e. a portrait photo or a square photo).

    I tried adding a separate line:
    Code:
    $slideimage.css({max-width:'250px'})
    ...with and without the single quotes. The script will not load if I add that line.

    Where exactly can I plug in this code to force the images to resize to the size of the slideshow? If I have the wrong code, what code can I implement?

    Thanks
    Last edited by shpemu; 10-26-2011 at 02:38 PM.

  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

    Rather than edit the script, leave it alone. Set max width/height styles in a stylesheet:

    Code:
    .gallerylayer img {
    	max-width: 250px;
    	max-height: 180px;
    }
    By way of explanation, gallerylayer is the class name of the script generated divisions that hold the slideshow images. Using max, means the images will be resized by the browser to fit a 250 x 180 box.

    Note - doesn't work in IE less than 7.
    - John
    ________________________

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

  3. #3
    Join Date
    Oct 2011
    Location
    Louisville, KY
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Works like a charm. Thanks!

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
  •