Reputation: 2444
On resize i need to get the new width and height of the div, I have doing this script using jquery-ui and jquery but it fail
$(this).resizable(function(){
console.log("Height: " + $(this).height());
console.log("Width: " + $(this).width());
});
help to find how to correct this error.
Upvotes: 0
Views: 286
Reputation: 11
This is how I've been doing it:
<script>
function resizeDiv() {
vpw = $(window).width();
vph = $(window).height();
console.log("Width: " + vpw);
console.log("Height: " + vph);
}
window.onresize = function(event) {
resizeDiv();
}
</script>
Upvotes: 1
Reputation: 177692
$(this).resizable()
.on("resize", function() {
console.log("Height: " + $(this).height());
console.log("Width: " + $(this).width());
});
or
$(this).resizable({
resize: function(event, ui ) {
console.log("Height: " + ui.height());
console.log("Width: " + ui.width());
}
});
Upvotes: 2
Reputation: 79
Have you tried this ?
$(this).on('resize',function(){
// Your stuff goes here
});
Upvotes: 1