How to perform multiple actions on the same element using jquery
-
26-10-2019 - |
문제
how do I include both drag and resize on a single element.
<head>
<style type="text/css">
#header { width: 200px; height: 100px; background: blue; }
</style>
<script>
$(document).ready(function() {
$("#header").draggable().resizable();
});
</script>
</head>
<body style="font-size:100%;font-weight:bold;font-style:times" >
<div id="header">
<label> Header <input type="text" value="headerBox" /> </label>
<input type="button" value="submit" id="headerSubmit" name="submit" />
<input type="reset" value="reset"/>
</div>
</body>
</html>
해결책
both draggable and resizable supports chaining mode so you can simplify your code in one line
$(document).ready(function() {
$("#header").draggable().resizable();
});
see demo here.... DEMO
refer this tutorial for more information .....Draggable and resizable
다른 팁
$(document).ready(function() {
$("#header").draggable();
$("#header").resizable();
});
see if it works
제휴하지 않습니다 StackOverflow