未捕获的TypeError:对象[object Object]没有方法'draggable'。 (Booklet jquery插件)

时间:2012-08-15 05:41:05

标签: jquery jquery-plugins

我正在尝试将Booklet jquery插件用于我的项目,但手动和键盘控件无效。这似乎是由于这个错误。

Booklet plugin homepage

Direct link to the js file of the plugin. Error occurs at line 1194.

错误发生在此特定行:

    // manual page turning, check if jQuery UI is loaded
    target.find('.b-page').draggable('destroy').removeClass('b-grab b-grabbing');
    if(options.manual && $.ui) {

我的HTML:

<!doctype html>

<html>
<head>
    <meta charset="UTF-8"/>
            <title> asfds </title>
<link rel="stylesheet" type="text/css" media="screen" href="fgerg.css" />
<link href="scripts/jquery.booklet.1.4.0.css" type="text/css" rel="stylesheet" media="screen" />


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

<script src="scripts/jquery.easing.1.3.js" type="text/javascript"></script>
        <script src="scripts/jquery.booklet.1.4.0.js" type="text/javascript"></script>


<script type="text/javascript">
                $(document).ready(function() {

                $(function() {
                    $('#mybook').booklet(); 
                    keyboard: true
                });     
                }); 
            </script>

</head>

<body>

    <div id="mybook">
        <div> 
            <h3>Yay, Page 1!</h3>
        </div>
        <div> 
            <img src="scripts/testmenu1.png" width="100%" height="100%" />
        </div>
        <div> 
            <h3>Yay, Page 3!</h3>
        </div>
        <div> 
            <h3>Yay, Page 4!</h3>
        </div>
        <div> 
            <h3>Yay, Page 5!</h3>
        </div>
        <div> 
            <h3>Yay, Page 6!</h3>
        </div>
</body>     
    </div>

    </html>

2 个答案:

答案 0 :(得分:21)

我认为draggable来自JQuery UI,所以你可能也需要包含它。

答案 1 :(得分:0)

 $(function() {
                $('#mybook').booklet( {keyboard: true} ); 

            });     

在booklet()函数中放入“keyboard:true”来获取选项