为什么javascript gridster插件调整大小不起作用

时间:2014-04-19 16:11:26

标签: javascript gridster

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>gridster.js</title>


    <link rel="stylesheet" type="text/css" href="http://gridster.net/dist/jquery.gridster.min.css">

    <link rel="stylesheet" href="http://gridster.net/assets/css/style.css">
    <link href='http://fonts.googleapis.com/css?family=Rancho' rel='stylesheet' type='text/css'>
</head>
<body>

<div class="gridster">
<p>asdasdsadsda</p>
<div class="bla" style="border: 1px solid black; height: 180px; width: 500px;">
<div data-row="1" data-col="1" data-sizex="1" data-sizey="1"></div>
<div data-row="2" data-col="1" data-sizex="1" data-sizey="1"></div>
<div data-row="3" data-col="1" data-sizex="1" data-sizey="1"></div>



</div>
</div>





<script type="text/javascript" src="http://gridster.net/assets/js/libs/jquery-1.7.2.min.js"></script>
  <script src="http://gridster.net/dist/jquery.gridster.js" type="text/javascript" charset="utf-8"></script>

<script>
$(function(){ //DOM Ready




$(".bla").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [140, 140],
widget_selector : "div",
resize: {
  enabled: true
}
});


});
</script>
</body>
</html>

这是我的代码,请问,为什么我的glister调整大小功能无法正常工作?

1 个答案:

答案 0 :(得分:2)

你的脚本应该添加.data('gridster')

   
<script>
$(function(){ //DOM Ready
$(".bla").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [140, 140],
widget_selector : "div",
resize: {
  enabled: true
}
}).data('gridster');


});
</script>