正在调整图像的新宽度和高度
getting resized image new width and height
调整大小时,我需要获得 div 的新宽度和高度,
我使用 jquery-ui 和 jquery 执行此脚本,但它失败了
$(this).resizable(function(){
console.log("Height: " + $(this).height());
console.log("Width: " + $(this).width());
});
帮助查找如何更正此错误。
你试过这个吗?
$(this).on('resize',function(){
// Your stuff goes here
});
$(this).resizable()
.on("resize", function() {
console.log("Height: " + $(this).height());
console.log("Width: " + $(this).width());
});
或
$(this).resizable({
resize: function(event, ui ) {
console.log("Height: " + ui.height());
console.log("Width: " + ui.width());
}
});
我就是这样做的:
<script>
function resizeDiv() {
vpw = $(window).width();
vph = $(window).height();
console.log("Width: " + vpw);
console.log("Height: " + vph);
}
window.onresize = function(event) {
resizeDiv();
}
</script>
调整大小时,我需要获得 div 的新宽度和高度, 我使用 jquery-ui 和 jquery 执行此脚本,但它失败了
$(this).resizable(function(){
console.log("Height: " + $(this).height());
console.log("Width: " + $(this).width());
});
帮助查找如何更正此错误。
你试过这个吗?
$(this).on('resize',function(){
// Your stuff goes here
});
$(this).resizable()
.on("resize", function() {
console.log("Height: " + $(this).height());
console.log("Width: " + $(this).width());
});
或
$(this).resizable({
resize: function(event, ui ) {
console.log("Height: " + ui.height());
console.log("Width: " + ui.width());
}
});
我就是这样做的:
<script>
function resizeDiv() {
vpw = $(window).width();
vph = $(window).height();
console.log("Width: " + vpw);
console.log("Height: " + vph);
}
window.onresize = function(event) {
resizeDiv();
}
</script>