jQuery UI Resizable resize Events
Last Updated :
07 Feb, 2022
jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Resizable resize event is triggered during the resize operation.
Syntax:
Initializing the resizable resize event.
$( ".selector" ).resizable({
resize: function( event, ui ) {}
});
Binding an event listener to the resize event.
$( ".selector" ).on( "resize", function( event, ui ) {} );
Restricting height resizing to 27 pixel increments.
$( ".selector" ).resizable({
resize: function( event, ui ) {
ui.size.height = Math.round( ui.size.height / 27 ) * 27;
}
});
Parameters: It accepts a callback function that has two parameters.
event: It accepts event type value.
ui: It accepts Object type values that are illustrated below.
- element: The jQuery object representing the element to be resized
- helper: The jQuery object representing the helper that's being resized
- originalElement: The jQuery object representing the original element before it is wrapped
- originalPosition: The position represented as { left, top } before the resizable is resized
- originalSize: The size represented as { width, height } before the resizable is resized
- position: The current position represented as { left, top }. The values may be changed to modify where the element will be positioned. Useful for custom resizing logic.
- size: The current size represented as { width, height }. The values may be changed to modify where the element will be positioned. Useful for custom resizing logic.
CDN Link: First, add jQuery UI scripts needed for your project.
<link rel=”stylesheet” href=”//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”>
<script src=”//code.jquery.com/jquery-1.12.4.js”></script>
<script src=”//code.jquery.com/ui/1.12.1/jquery-ui.js”></script>
Example: This example demonstrates the jQuery UI Resizable resize Events.
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href=
"//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<script src=
"//code.jquery.com/jquery-1.12.4.js">
</script>
<script src=
"//code.jquery.com/ui/1.12.1/jquery-ui.js">
</script>
<style>
h1 {
color: green;
}
#GFG {
width: 150px;
height: 150px;
background: green;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
</style>
</head>
<body>
<center>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h3>jQuery UI Resizable resize Events</h3>
<div id="log"></div>
<div id="GFG">GeeksforGeeks</div>
</center>
<script>
$(document).ready(function () {
$("#GFG").resizable({
resize: function (event, ui) {
ui.size.height =
Math.round(ui.size.height / 27) * 27;
}
});
$("#GFG").on("resize", function (event, ui) {
$("#log").html('Resize operation is going on.');
});
});
</script>
</body>
</html>
Output:
Reference: https://api.jqueryui.com/resizable/#event-resize
Similar Reads
jQuery UI Resizable stop Events jQuery UI is a web-based technology and consists of GUI widgets, visual effects, and themes implemented using the jQuery, JavaScript Library. jQuery UI is the best tool for building UI interfaces for the webpages. It can also be used to build highly interactive web applications or can be used to add
2 min read
jQuery UI Resizable start Events jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Resizable start event is triggered when the resize operation is started. Syntax: Initializing the resizable start event
2 min read
jQuery UI Resizable create Events jQuery UI consists of GUI widgets, visual effects, and themes implemented using HTML, CSS, and jQuery. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Resizable create event is triggered when the resizable is created. Syntax: Initializing the resizable create event. $(
2 min read
jQuery UI Dialog resize Event jQuery UI resize event is triggered when the dialog box is resized. Learn more about jQuery selectors and events here. Syntax: $(".selector").dialog ( resize: function( event, ui ) { console.log('resized') },Approach: First, add jQuery Mobile scripts needed for your project.<link href = "https://
1 min read
EasyUI jQuery Resizable widget In this article, we will learn how to design a resizable widget using jQuery EasyUI. A resizable widget makes the given element resizable. It helps in building features for interactive web and mobile applications saving a lot of time for developers. Downloads for EasyUI for jQuery: https://www.jeasy
2 min read