Jquery可拖动和溢出滚动

时间:2013-10-21 11:25:05

标签: jquery

我只是想知道是否有可能让溢出滚动与Jquery UI在移动电话上拖动一起工作。我知道Jquery UI在移动设备上不起作用,但我有一个破解它的脚本,所以它不仅对鼠标有反应,而且还有触摸。

现在,如果我放入一个代码让Jquery UI可拖动工作,那么溢出滚动就不会这样,我只是想知道是否有人知道如何解决这个问题?

这是我的代码

 <!DOCTYPE HTML>
<html >
<head>
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no, width=100%" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script src="http://webprofolio.freeserver.me/jquery.ui.touch-punch.min.js"></script>
<style>

#parent
{
    background-color:blue;
    width:400px;
    height:400px;
}

#content
{
    background-color:red;
    width:380px;
    height:380px;
    overflow-y:auto;
    margin:auto;
}

#thebody
{
    background-color:green;
    width:600px;
    height:400px;
}  

</style>

</head>
<body>

<div id="thebody">
<div id="parent">
<div id="content">
<p>
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
Hello gentlemen welcome to the end of the days!!! you want to buy some sandwiches? No thanks, I don't like strawberries
The last paragraph
</p>
</div>
</div>
</div>

<script>

touchMove();

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

}



</script>


</body>
</html>

1 个答案:

答案 0 :(得分:0)

您缺少结束标记“&gt;”

<script src="http://webprofolio.freeserver.me/jquery.ui.touch-punch.min.js"</script>

<script src="http://webprofolio.freeserver.me/jquery.ui.touch-punch.min.js"></script>

现在工作正常。