Use this unofficial version of the script (right click and 'Save As'):
fadeslideshowresp.js
It allows you to do like:
Code:
var mygallery=new fadeSlideShow({
wrapperid: "image1", //ID of blank DIV on page to house Slideshow
dimensions: ['100%', 340], //width, height of gallery in jQuery css dimensional valuesimage
imagearray: [
["img/main_image_home_01.jpg",],
["img/main_image_home_02.jpg . . .
Set it just like that, with the second dimension set to the native height. But that's only part of it. You also have to setup an oninit and styles to go with it.
I just did this for someone a little while ago. Following that, you should setup your on page code like so:
Code:
var mygallery=new fadeSlideShow({
wrapperid: "image1", //ID of blank DIV on page to house Slideshow
dimensions: ['100%', 340], //width, height of gallery in jQuery css dimensional values
imagearray: [
["img/main_image_home_01.jpg",],
["img/main_image_home_02.jpg",],
["img/main_image_home_03.jpg",],
["img/main_image_home_04.jpg",],
["img/main_image_home_05.jpg",],
["img/main_image_home_06.jpg",],
["img/main_image_home_07.jpg",] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1500, //transition duration (milliseconds)
descreveal: "ondemand",
//this code resizes the show based upon width of the parent div
oninit: function(){
var g = this, s = g.setting, $wrap = s.$wrapperdiv, $desc = s.$descpanel, $dbg = $desc.find('div.descpanelbg'), $dfg = s.$descinner;
$wrap.height($wrap.width() * 340 / 690); //ratio for images (native dimensions height / width)
if(!$wrap.data('descwidthsetup')){
jQuery(window).resize(function(){s.oninit.apply(g);});
function stripwidth($el){
var extras = ['borderRightWidth', 'borderLeftWidth', 'marginRight', 'marginLeft', 'paddingRight', 'paddingLeft'],
el = extras.length, extra = 0, v;
while(--el > -1){v = parseFloat($el.css(extras[el])); extra += isNaN(v)? 0 : v;}
return extra;
}
s.descwidthminus = [stripwidth($dbg.height('200%')), stripwidth($dfg)];
}
$wrap.data({descwidthsetup: 'setup'});
$wrap.trigger('mouseleave');
this.showhidedescpanel('hide', 0);
$dbg.width($desc.width() - s.descwidthminus[0]);
$dfg.add(s.$measure).width($desc.width() - s.descwidthminus[1]).css('marginLeft', $dfg.css('marginLeft'));
},
togglerid: ""
});
Notice the highlighted line. The red numbers are the native height / native width - that's needed to establish the ratio for resizing the container/images.
You will also need styles for the page like:
Code:
.gallerylayer img { /* make slide images scalable */
height: auto !important;
width: 100% !important;
vertical-align: bottom;
max-width: none;
}
The browser cache may need to be cleared and/or the page refreshed to see changes.
Now, any of this might need to be tweaked for your specific page.
If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
For more info on this technique, see the original thread:
http://www.dynamicdrive.com/forums/s...idth-Slideshow
Demo (if it's still up):
http://www.digitalprecision.ca/newindex.php
Bookmarks