图像滑块仅调整大于固定尺寸的图像大小?
我需要一个图像滑块,它仅在需要时调整图像大小(图像的大小大于包含滑块的 div)。
我尝试过 AnythingSlider,但是当我将宽度和高度设置为包含滑块的 div 时,小于该 div 的图像会被拉伸。我不想让他们被拉长。
I need an image slider which resizes the images only if its needed (the size of the image is bigger than the div containing the slider).
I've tried with AnythingSlider, but when I set the width and height to the div containing the slider, the images that are smaller than the div are stretched. I don't want them to be stretched.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需检查 javascript/jquery 即可查看图像的大小。如果它比所需的尺寸大,您可以将其缩小。
You could just do a check in javascript/jquery to see what the size of the image is. If it's bigger than the desired dimension you can just scale it down.
玩这个。添加样式条件
http://webdesignledger.com/tutorials/create -a-ressized-image-grid-with-jquery
http://demos.webdesignledger .com/jquery_image_grid/example2.htm
play with this . add condition for styling
http://webdesignledger.com/tutorials/create-a-resizable-image-grid-with-jquery
http://demos.webdesignledger.com/jquery_image_grid/example2.htm