Jason
Jason

Reputation: 7682

dynamically resize images w/ jquery

I'm using a script that uses DD's Ultimate Fade-in Slideshow: http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

It uses jquery, and I would like to resize the images to the slideshow size.

Thanks!

Upvotes: 3

Views: 775

Answers (2)

Jason
Jason

Reputation: 7682

I figured it out:

fadeSlideShow.routines={

getSlideHTML:function(imgelement){
    var layerHTML=(imgelement[1])? '<a href="'+imgelement[1]+'" target="'+imgelement[2]+' ">\n' : '' //hyperlink slide?
    layerHTML+='<img src="'+imgelement[0]+'" style="border-width:0; width: 440px;" />\n'

I just added a width to the style call...

Upvotes: 0

Mark
Mark

Reputation: 5720

If you want to animate the size of the images you can use:

jQuery('#imgID').animate({
  width: newwidth,
  height: newheight
});

or if you don't want to animate the resizing just use

jQuery('#imgID').css({'width':'newwidth', 'height':'newheight'});

newheight and newwidth would be integers of whatever dimensions you want to give it. i.e. 100px x 200px

Upvotes: 1

Related Questions