javascript - Grid Element initialising vertically Gridster.js -


well using gridster.js make dashboard environment , wrote following code. problem elements stack vertically when want them initialised according row , col numbers specified in html tag attributes 'data-row' , 'data-col'.

i checked console there no js errors. after page loaded , elements stacked vertically can still drag them , can formed grid dragging 1 after other.

please can tell me doing wrong not getting elements stacked in grid format when page loads.

here image of output: as can see elements vertically stacked on top of 1 another

here code:

<html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title>gridster test page</title> </head> <body>     <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>     <link href="../third party libraries/gridster/gridster.min.css"></link>     <script src="../third party libraries/gridster/gridster.min.js"></script>     <script>             var gridster;             $(function () {                 gridster = $(".gridster > ul").gridster({                      widget_margins: [10, 10],                     widget_base_dimensions: [140, 140],                     min_cols: 6,                     min_rows: 5,                     resize: {                         enabled: true                     }                 }).data('gridster');             }) </script> <style>     ul, ol {         list-style: none;     }      h1 {         margin-bottom: 12px;         text-align: center;         font-size: 30px;         font-weight: 400;     }      h3 {         font-size: 25px;         font-weight: 600;         color: white;     }      /* gridster styles */     .demo {         margin: 3em 0;         padding: 7.5em 0 5.5em;         background: #004756;     }          .demo:hover .gridster {             opacity: 1;         }      .gridster {         width: 940px;         margin: 0 auto;         opacity: .8;         -webkit-transition: opacity .6s;         -moz-transition: opacity .6s;         -o-transition: opacity .6s;         -ms-transition: opacity .6s;         transition: opacity .6s;     }          .gridster .gs_b {             background: blue;             cursor: pointer;             -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);             box-shadow: 0 0 5px rgba(0,0,0,0.3);         }         .gridster .gs_y {             background: yellow;             cursor: pointer;             -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);             box-shadow: 0 0 5px rgba(0,0,0,0.3);         }         .gridster .gs_g {             background: green;             cursor: pointer;             -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);             box-shadow: 0 0 5px rgba(0,0,0,0.3);         }         .gridster .gs_o {             background: orange;             cursor: pointer;             -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);             box-shadow: 0 0 5px rgba(0,0,0,0.3);         } </style> <div class="gridster ready">     <ul style="height: 640px; width: 960px; position: relative;">         <li data-row="1" data-col="1" data-sizex="1" data-sizey="1" class="gs_b">a</li>         <li data-row="2" data-col="1" data-sizex="1" data-sizey="1" class="gs_b">b</li>         <li data-row="3" data-col="1" data-sizex="1" data-sizey="1" class="gs_b">b</li>          <li data-row="1" data-col="2" data-sizex="2" data-sizey="1" class="gs_g">c</li>         <li data-row="2" data-col="2" data-sizex="2" data-sizey="2" class="gs_g">d</li>          <li data-row="1" data-col="4" data-sizex="1" data-sizey="1" class="gs_y">e</li>         <li data-row="2" data-col="4" data-sizex="2" data-sizey="1" class="gs_y">f</li>         <li data-row="3" data-col="4" data-sizex="1" data-sizey="1" class="gs_y">g</li>          <li data-row="1" data-col="5" data-sizex="1" data-sizey="1" class="gs_o">h</li>         <li data-row="3" data-col="5" data-sizex="1" data-sizey="1" class="gs_o">i</li>          <li data-row="1" data-col="6" data-sizex="1" data-sizey="1" class="gs_g">k</li>         <li data-row="2" data-col="6" data-sizex="1" data-sizey="2" class="gs_b">j</li>     </ul> </div> 

try delete "ready" part class

<div class="gridster"> 

i pretty sure done plugin.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -