想中心对齐宽度为100%的Div

时间:2014-04-20 15:11:29

标签: javascript css scroll

我在我的网站上使用此插件http://joelb.me/scrollpath/ .. 我网站的Wireframe看起来像http://i.stack.imgur.com/ohcoa.png

如您所见,路径为白色,方框是需要放置的div。我希望我的div宽度为100%并且居中对齐但是当我这样做时div不在中心它们向右浮动但是当尺寸小于800px它们仍然在中心时...有人请帮帮我吗??!

我的代码:

function init() {
    $.fn.scrollPath("getPath").moveTo(400, 300, {
        name: "start"
    }).lineTo(400, 800, {
        callback: function () {
            highlight($(".description"));
            alert("you have reached description")
        },
        name: "description"
    }).lineTo(400, 1600, {
        callback: function () {
            highlight($(".settings"))
        },
        name: "syntax"
    }).lineTo(1750, 1600, {
        callback: function () {
            highlight($(".sp-scroll-handle"))
        },
        name: "scrollbar"
    }).lineTo(2400, 2750, {
        callback: function () {
            highlight($(".source"));
            alert("you have reached source")
        },
        name: "source"
    }).moveTo(2400, 2750, {
        name: "bitch"
    }).lineTo(6950, 2750, {
        callback: function () {
            highlight($(".follow"))
        },
        name: "follow"
    }).lineTo(6950, 4750, {
        name: "end"
    })
}

0 个答案:

没有答案