jquery - Resizing of div by dragging -


page layout

as depicted image want resize "document icons" div dragging upwards , should accommodated decreasing height of "document viewer". need temporary slider show dragging on screen.

question modified: html

<div id="centerdiv" class="centerdiv" style="position:relative;float: left;width: 63%;height: 600px;border-right: 10px solid #ddd;">  <div class="header" style="width: 100%;height: 15px;background-color: #ddd;"></div>  <div class="documentviewer" id="documentviewer" style="width: 100%;height: 500px;margin-bottom: 5px;">     <iframe id="framevalue" name="framevalue" src="nodocument.html" width="100%" height="500px" style="margin-bottom: 5px;"></iframe> </div>  <div class="dragdiv" id="dragdiv" style="width: 100%;height: 15px;cursor: row-resize;background-color: green;"></div>  <div class="iconlist" id="iconparent" style="position:relative;width: 100%;height: 70px;background-color: #ddd;"></div> 

jquery

$('#dragbar').mousedown(function(e) {     e.preventdefault();     dragging = true;      var main = $('#documentviewer');      var scrollbar = $("<div>'",                     {id:'scrollbar',                     css: {                         height: '5px',                         top:'530px',                         left:'40px',                         z-index:'100',                         background-color: 'red'                      }                     }).appendto('body');     $(document).mousemove(function(e) {       scrollbar.css("top",e.pagex+2);    });      if(dragging) {                     $(window).mouseup(function(e) {             $('#position').html(e.pagex +', '+ e.pagey);             $('#iconparent').css("height",e.pagey+2);             $('#documentviewer').css("height",(600-(e.pagey+30)));             $(document).unbind('mousemove');         });     } }); 

you can make use of jquery ui this. supports resizing of items. can find example here. although on element , not element. this:

$("#resizable").resizable();
#resizable {    width: 150px;    height: 150px;    padding: 0.5em;  }  #resizable h3 {    text-align: center;    margin: 0;  }  .buttons {    position: absolute;    bottom: 0px;    text-align: center;  }  .content {    height: auto;    overflow: scroll;    overflow-x: hidden;    height: 100%;    margin-top: -5px;  }
<!doctype html>  <html lang="en">    <head>    <meta charset="utf-8">    <title>jquery ui resizable - default functionality</title>    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">    <script src="//code.jquery.com/jquery-1.10.2.js"></script>    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>    <link rel="stylesheet" href="/resources/demos/style.css">  </head>    <body>      <div id="resizable" class="ui-widget-content">      <p class="content">content        <br />content        <br />content        <br />content        <br />content        <br />content        <br />content        <br />      </p>      <div class="buttons">buttons</div>    </div>      </body>    </html>


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -