Jquery pageinit not firing

I have 2 pages that I linked to using the swipeleft and swiperight event (back and forth), but when I iterate over another page, jquery does not fire the pageinit event, and I only leave the header and footer. Should I use the changePage event or use the loadPage event? I know that there is an error in another version of jquerymobile where the pageinit event does not fire, but I already use RC1, which already solved it, but the event still does not fire. what prevents him from shooting? Thanks in advance.

The code is as follows:

      <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>esports</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css" />
<link rel="stylesheet" href="jquery.zrssfeed.css" />
</script>

<style>


</style>
</head>
<body>
<!-- index -->
<div data-role="page" id="index">
    <div data-role="header">
        <h1>esports times</h1>
    </div>
    <!--/header-->
    <div data-role="content" id="content">
        <div id="currentFeed">teamliquid. &nbsp; skgamin</div>
        <ul id="rssFeed" data-role="listview">
        </ul>
    </div>
</div>

</body>
</html>

<!-- load javscripts here-->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js">     </script>
<script src="jquery.zrssfeed.js"></script>
<script>
    $('#index').bind("pageinit", (function () {
        $('#rssFeed').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews', {
            limit: 10,
            date: false,
        });
    }));

    $('#index').bind("swipeleft", function () {
        $.mobile.changePage("teamliquid.html", "slide", true, false);
    });
</script>

<!-- /javascript-->
+5
source share
2 answers

- , . dom, , .

init , , . id = "# index". , . #index, teamliquid.html.

<head></head> :

$(document).on('pageinit','#index', function(){
    $('#rssFeed').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews', {
      limit: 10,
      date: false,
    });
});
$(document).on('pageinit','#otherpage', function(){
    ... This would be for the other page you are referring to....
});
$(document).on('swipeleft','#index', function(){
    $.mobile.changePage("teamliquid.html", { transition: "slide" });
});
$(document).on('swiperight','#otherpage', function(){
    $.mobile.changePage("index.html", { transition: "slide" });
});

$(document).on('pageinit','[data-role=page]', function(){
    ....ground breaking code...    
});

jquery 1.7 bind, live delegate .on(). JQM. , "#index" "[data-role = page]", . JSfiddle, , . http://jsfiddle.net/codaniel/cEWpy/2/

+6


$(function() { /* dom ready */ });

$('#index').bind("pageinit", (function () { ... }));

script -tags head, </script> 9, HTML, .

-1

All Articles