Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.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 jquery中的包含_Javascript_Jquery_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript jquery中的包含

Javascript jquery中的包含,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我正在尝试创建具有开/关状态的开关按钮(使用twitter引导) 在这个演示中,您可以看到我有一个外边框按钮。按钮可拖动为x偏移 我希望按钮不要超出我的边界。所以我把它放在一个div元素中,并将它设置为某个宽度。 我认为情况不太好 请建议我如何在边境地区绑定此按钮 小提琴连杆- 一些代码架- <div style="width:200px;border:1px dashed #ddd"> <p id="button" class="btn-inverse btn"&g

我正在尝试创建具有开/关状态的开关按钮(使用twitter引导)

在这个演示中,您可以看到我有一个外边框按钮。按钮可拖动为x偏移

我希望按钮不要超出我的边界。所以我把它放在一个
div
元素中,并将它设置为某个宽度。 我认为情况不太好

请建议我如何在边境地区绑定此按钮

小提琴连杆-

一些代码架-

<div style="width:200px;border:1px dashed #ddd">
    <p id="button" class="btn-inverse btn">Regular link</p>
</div>         

添加一个额外的参数,如中所述

这样,理论上甚至不需要axis参数

$(document).ready(function () {


        $('#button').draggable({ axis: 'x' });

    });
    $('#button').draggable({ axis: 'x',containment: "parent" });