Javascript 如何设置gridster.js的中心?
我一直在玩Gridster.js,但就我的一生而言,我似乎无法使网格居中,它总是左对齐,我尝试了又尝试,但可能我错过了一些东西 我已经制作了一个JSFIDLE,它具有我的网格的基础,我希望有人能够解决它并帮助我将其居中,请:)Javascript 如何设置gridster.js的中心?,javascript,jquery,html,css,gridster,Javascript,Jquery,Html,Css,Gridster,我一直在玩Gridster.js,但就我的一生而言,我似乎无法使网格居中,它总是左对齐,我尝试了又尝试,但可能我错过了一些东西 我已经制作了一个JSFIDLE,它具有我的网格的基础,我希望有人能够解决它并帮助我将其居中,请:) 谢谢谢谢Paulie_D,我设法解决了这个问题并把它放在中心:) 它是居中的…但它也是100%宽的…不知道你在问什么。你说它居中是什么意思?当我查看JSFIDLE(和我的live站点)时,框都是左对齐的,右边有很多未使用的空间,因为我的网格只有5列,我希望5列网格位于彩
谢谢谢谢Paulie_D,我设法解决了这个问题并把它放在中心:)
它是居中的…但它也是100%宽的…不知道你在问什么。你说它居中是什么意思?当我查看JSFIDLE(和我的live站点)时,框都是左对齐的,右边有很多未使用的空间,因为我的网格只有5列,我希望5列网格位于彩色包装的中心。然后需要在包含的div上设置一个宽度,以便
边距:auto
将其置于包装内的中心。确定,我仍然不能按照我的预期工作,你能用你的意思更新JSFIDLE,让我看到它工作吗?
.gridster {
background: #004756;
margin: 0 auto;
opacity: .8;
-webkit-transition: opacity .6s;
-moz-transition: opacity .6s;
-o-transition: opacity .6s;
-ms-transition: opacity .6s;
transition: opacity .6s;
text-align: center;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}
.gridster .gs_w{
z-index: 2;
position: absolute;
background: #FFF;
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);
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s;
-moz-transition: opacity .3s, left .3s, top .3s;
-o-transition: opacity .3s, left .3s, top .3s;
transition: opacity .3s, left .3s, top .3s;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
}
.gridster .preview-holder {
z-index: 1;
position: absolute;
background-color: #fff;
border-color: #fff;
opacity: 0.3;
}
.gridster .player-revert {
z-index: 10!important;
-webkit-transition: left .3s, top .3s!important;
-moz-transition: left .3s, top .3s!important;
-o-transition: left .3s, top .3s!important;
transition: left .3s, top .3s!important;
}
.gridster .dragging {
z-index: 10!important;
-webkit-transition: all 0s !important;
-moz-transition: all 0s !important;
-o-transition: all 0s !important;
transition: all 0s !important;
}
.gridWrapper {
width: 100%;
overflow-x: scroll;
overflow-y: hidden;
}
.gridAlignerWrapper {
display: table;
width: 100%;
height: 100%;
}
.gridAligner {
width: 100%;
display: table-cell;
}
body {
background-color: #EEEEEE;
font-family: 'Helvetica Neue', Arial, sans-serif;
-webkit-font-smoothing: antialiased;
font-size: x-small;
color: #666666;
text-align: center;
vertical-align: middle;
}
ul, ol {
list-style: none;
margin:0 auto;
text-align: center;
vertical-align: middle;
}
h1 {
margin-bottom: 12px;
text-align: center;
font-size: 30px;
font-weight: 400;
}
h3 {
font-size: 25px;
font-weight: 600;
color: white;
}
/* Uncomment this if you set helper : "clone" in draggable options */
/*.gridster .player {
opacity:0;
}*/
.gridster {
width: 730px;
background: #004756;
margin-left:auto;
margin-right:auto;
opacity: .8;
-webkit-transition: opacity .6s;
-moz-transition: opacity .6s;
-o-transition: opacity .6s;
-ms-transition: opacity .6s;
transition: opacity .6s;
text-align: center;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}