jQuery UI滑块来调整图像大小 [英] jQuery UI slider to resize image
本文介绍了jQuery UI滑块来调整图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想制作一个jQuery UI滑块来调整我的图片大小。
然而图像大小是不一样的,所以我想调整大小百分比的比率。
这是我到目前为止做的: http://jsfiddle.net/Au3kk/
I would like to make a jQuery UI slider wich resize my image size. However the image size is never the same so I would like to resize with percentage respecting the ratio. Here is what I've done so far : http://jsfiddle.net/Au3kk/
我试过这个,但它不适用于这个事件:
I tried this but it doesn't work on the event :
width : ($(this).css('width')) + (ui.value + "%");
我是Javascript新用户,希望你不会和我在一起。
非常感谢。
I'm new with Javascript I hope you won't be to hard with me. Thanks a lot.
推荐答案
如何存储原始宽度:
var orginalWidth = $("#image").width();
然后使用:
$("#image").width(orginalWidth * (1 + ui.value/100));
这篇关于jQuery UI滑块来调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文