当我使用最新版本的jQuery时,小提琴不起作用

时间:2012-07-19 17:03:16

标签: javascript jquery

当我使用jQuery 1.5.2时,为什么这个小提琴才起作用?

http://jsfiddle.net/azZVk/17/

enter image description here

当我将其设置为jQuery 1.7.2时,不会显示任何内容

enter image description here

在这里取消选择jQuery Mobile 1.0.1是显示:

enter image description here

应该显示这个:

enter image description here

小提琴代码:

<div data-role="page" id="firstpage">

        <div data-role="header">
                <h1>First Page</h1>
        </div>

<div data-role="content" id="links">

</div>

        <div data-role="footer">
                <h4>Page Footer</h4>
        </div>

</div>

<div data-role="page" id="secondpage">

        <div data-role="header">
                <a href='#' class='ui-btn-left' data-icon='arrow-l' onclick="history.back(); $('#pagecontent').empty(); return false">Back</a><h1>Bar</h1>
        </div>

        <div id="pagecontent" data-role="content">

        </div>

        <div data-role="footer">
                <h4>Page Footer</h4>
        </div>
</div>

$(document).ready(function() {

for (var i = 0; i < 4; i++) {  
    $('#links').append(buildButton());     
}

   function buildButton() {
    var button= '<a data-role="button" href="#secondpage" data-theme="c" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">Link Button</span></span></a>';

    return $(button).click(function () {
        $("#secondpage").data("val", "test value")
    });       
   }

    $('#secondpage').live('pageshow', function() {
        var val1= $(this).data('val');
        $("#pagecontent").html(val1);
        console.log('val is '+ val1);
    });

});

1 个答案:

答案 0 :(得分:1)

问题在于您选择1.7.2

您还勾选了Mobile 1.0.1

修改: 你在这里使用的是错误的版本

In your Resources

将它们更新为最新版本以使用1.7.2

CSShttp://code.jquery.com/mobile/1.1.0jquery.mobile-1.1.0.css

JShttp://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js

1.7.2合作:http://jsfiddle.net/azZVk/25/

此外,请勿使用live我们on