Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Snap.js填充内容_Javascript_Html_Css_Snap.js - Fatal编程技术网

Javascript 使用Snap.js填充内容

Javascript 使用Snap.js填充内容,javascript,html,css,snap.js,Javascript,Html,Css,Snap.js,我只有一个简单的问题。我使用snap.js创建一个可滑动的菜单,但是如何向contant添加填充 资料来源如下: GitHub上的源项目: 以下是内容的代码: <div id="content" class="snap-content"> <div id="toolbar"> <a href="#" id="open-left"></a> <h1>Default</h1> &l

我只有一个简单的问题。我使用snap.js创建一个可滑动的菜单,但是如何向contant添加填充

资料来源如下:

GitHub上的源项目:

以下是内容的代码:

<div id="content" class="snap-content">
    <div id="toolbar">
        <a href="#" id="open-left"></a>
        <h1>Default</h1>
    </div>
    <!-- Here goes the content I guess, but there is no padding -->
</div>

违约
我需要在#内容中包含所有内容,以便用手指滑动。但是我不能让内容有填充,所以在我看来它看起来很糟糕。。如果我在内容中添加填充,菜单也会得到它。然后,我尝试添加一个名为#main的新
,并将其放置在#toolbar下,但由于某种原因,填充的效果就像边距一样#主管道的宽度为100%,填料为10px。#工具栏显示为100%,但显示为100%+10px(左)+10px(右),因此添加了滚动条,看起来很糟糕

其他人是如何解决这个问题的

正如您在这个JSFIDLE中看到的,没有填充:


提前感谢。

您可以将您想要的所有内容移动到新元素, 例如:

<div id="content" class="snap-content">
    <div id="toolbar">
        <a href="#" id="open-left"></a>
        <h1>Default</h1>
    </div>

    <div id="content-wrapper">
        <!-- Here goes the content I guess, but there is no padding -->
    </div>
</div>

好吧,我觉得自己被愚蠢之类的东西打败了P我试过用#main(带填充物的新div)这样做,但对我不起作用。现在我又试了一次,效果很好。谢谢你,伙计!
#content-wrapper{
    padding:10px;
}