imgSlider
imgSlider copied to clipboard
need to control max-width
Since this script manipulates the width of a div containing an image, the CSS needs to control the max-width. It is very common to use max-width:100% on images so that they scale, but that ruins the effect of this script. So the CSS should have .slider img {max-width:none} to make sure it works correctly, regardless of the user's CSS.
@joyously I am not quite sure I follow. Please go ahead and submit a pull request.
I've tried two different approaches, and I don't know which works best.
To test the plugin better, add some other common CSS to your demo, such as
img {max-width:100%} /*to make it like a 'real' page */
Then you will see that your plugin does not handle this well, so it either needs to use
.slider img {max-width:none}
or the script needs to use
$this.find('img').css('max-width', width + 'px'); //(but this might not work right, perhaps test 'none' here)
because the user should be able to have the image max-width set for their other images without affecting the plugin.