over 9 years ago
If you want your block draggable and resizable, the following code will help you for the same:
HTML:
- <section class="map">
- <div class="container-fluid">
- <div class="this-week panel-group dayListing" id="accordion" style="position:absolute; overflow:hidden;" >
- <h1 style="padding:10px; background:#ddd;" >Drag me</h1>
- <div class="drop-box panel-body"data-mcs-theme="dark">
- <ul>
- <li>Separated link 1</li>
- <li>Separated link 2</li>
- <li>Separated link 3</li>
- <li>Separated link 4</li>
- <li>Separated link 5</li>
- <li>Separated link 6</li>
- <li>Separated link 7</li>
- <li>Separated link 8</li>
- <li>Separated link 9</li>
- <li>Separated link 10</li>
- <li>Separated link 11</li>
- <li>Separated link 12</li>
- <li>Separated link 13</li>
- <li>Separated link 14</li>
- </ul>
- </div>
- </div>
- </div>
- </section>
<section class="map"> <div class="container-fluid"> <div class="this-week panel-group dayListing" id="accordion" style="position:absolute; overflow:hidden;" > <h1 style="padding:10px; background:#ddd;" >Drag me</h1> <div class="drop-box panel-body"data-mcs-theme="dark"> <ul> <li>Separated link 1</li> <li>Separated link 2</li> <li>Separated link 3</li> <li>Separated link 4</li> <li>Separated link 5</li> <li>Separated link 6</li> <li>Separated link 7</li> <li>Separated link 8</li> <li>Separated link 9</li> <li>Separated link 10</li> <li>Separated link 11</li> <li>Separated link 12</li> <li>Separated link 13</li> <li>Separated link 14</li> </ul> </div> </div> </div> </section>
CSS:
- #accordion .panel-body{ height: 330px;}
- .dayListing {background: #fff;box-shadow: 1px 1px 18px #666; position: absolute;right: 70px;top: 40px;width: 250px;}
#accordion .panel-body{ height: 330px;} .dayListing {background: #fff;box-shadow: 1px 1px 18px #666; position: absolute;right: 70px;top: 40px;width: 250px;}
Script:
Draggable:
Resizable:
- $( "#accordion" ).resizable({
- stop: function(event, ui) {
- var width = ui.size.width;
- var height = ui.size.height;
- $("#accordion .panel-body").width(width);
- $("#accordion .panel-body").height(height - 35);
- if($("#accordion .panel-body").width() < 250){
- $("#accordion .panel-body").css({"font-size":"12px"});
- } else {
- $("#accordion .panel-body").css({"font-size":"16px"});
- }
- }
- });
$( "#accordion" ).resizable({ stop: function(event, ui) { var width = ui.size.width; var height = ui.size.height; $("#accordion .panel-body").width(width); $("#accordion .panel-body").height(height - 35); if($("#accordion .panel-body").width() < 250){ $("#accordion .panel-body").css({"font-size":"12px"}); } else { $("#accordion .panel-body").css({"font-size":"16px"}); } } });
Can you help out the community by solving one of the following Javascript problems?
Do activity (Answer, Blog) > Earn Rep Points > Improve Rank > Get more opportunities to work and get paid!
For more topics, questions and answers, please visit the Tech Q&A page.
0 Comment(s)