dir.by  
  Search  
Programming, development, testing
jQuery UI - buttons, menus, dialog, slider, spinner and so on. Effects: stretching, dragging, and so on
Resizable (resize an item with the mouse) jQuery UI
  Looked at 6356 times    
 Resizable (resize an item with the mouse) jQuery UI 
last updated: 5 February 2020
Method resizable in the jQuery UI allows you to resize an element with the mouse.
Example we look, we test
Example code
  Html  
<html>

<!-- heading -->
<head>
     <meta charset="utf-8">
     <title>Example</title>
</head>

<!-- page -->
<body>
     <!-- connect libraries jQuery and jQuery UI -->
     <script src="https://dir.by/example_lib/jquery/jquery-3.3.1.min.js"></script>
     <script src="https://dir.by/example_lib/jquery_ui/jquery-ui-1.12.1/jquery-ui.min.js"></script>

     <!-- connect styles jQuery UI -->
     <link rel="stylesheet" href="https://dir.by/example_lib/jquery_ui/jquery-ui-1.12.1/jquery-ui.min.css">

     <!-- HTML Elements -->
     <div id="myElement1" style='height:100px; width:100px; background:#DAF0DA;'>
          <p>Stretch</p>
     </div>

     <!-- the page has opened -->
     <script>
          $( function()
          {
               // element myElement1 Can be stretched
               $("#myElement1").resizable();
          });
     </script>
</body>

</html>
Note!
The example works locally!

Run the example on your computer:
1) Create a new file my.html
2) Copy source code in the my.html file
3) Run in browser my.html

By the way!
The example allows you to stretch on the computer.
Example does not allow stretching on mobile devices (smartphones, tablets).
Stretching on mobile devices (smartphones, tablets)
Example we look, we test
Explanation
One line is added to the code, this is the connection of the library jQuery UI Touch Punch ... for stretching on tablet, phone.
  Html  
<script src="https://dir.by/example_lib/touch-punch/jquery.ui.touch-punch.js"></script>


All sample code to stretch on tablet, phone
In the code, the added line is highlighted Blue.
  Html  
<html>

<!-- heading -->
<head>
     <meta charset="utf-8">
     <title>Example</title>
</head>

<!-- page -->
<body>
     <!-- connect libraries jQuery and jQuery UI -->
     <script src="https://dir.by/example_lib/jquery/jquery-3.3.1.min.js"></script>
     <script src="https://dir.by/example_lib/jquery_ui/jquery-ui-1.12.1/jquery-ui.min.js"></script>

     <!-- connect styles jQuery UI -->
     <link rel="stylesheet" href="https://dir.by/example_lib/jquery_ui/jquery-ui-1.12.1/jquery-ui.min.css">

     <!-- drag-and-drop library for tablet, phone -->
     <script src="https://dir.by/example_lib/touch-punch/jquery.ui.touch-punch.js"></script>

     <!-- HTML Elements -->
     <div id="myElement1" style='height:100px; width:100px; background:#DAF0DA;'>
          <p>Stretch</p>
     </div>

     <!-- the page has opened -->
     <script>
          $( function()
          {
               // element myElement1 Can be stretched
               $("#myElement1").resizable();
          });
     </script>
</body>

</html>
 
← Previous topic
Droppable (a dragged item can be thrown) jQuery UI
 
Next topic →
Selectable (select one or more elements with the mouse) jQuery UI
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

  Объявления  
  Объявления  
 
What the JQuery UI ?
jQuery UI where to download and how to connect?
Interactions (interaction)
Draggable (the item can be moved with the mouse) jQuery UI
Droppable (a dragged item can be thrown) jQuery UI
Resizable (resize an item with the mouse) jQuery UI
Selectable (select one or more elements with the mouse) jQuery UI
WWW sites to explore JQuery UI
Sites to explore JQuery UI

  Ваши вопросы присылайте по почте: info@dir.by  
Яндекс.Метрика