mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-21 06:40:59 +00:00
render prefetched pages according to their data-rel attr fixes #2335
This commit is contained in:
parent
475069becd
commit
f0db137ed9
1 changed files with 7 additions and 4 deletions
|
|
@ -1350,16 +1350,19 @@
|
|||
});
|
||||
|
||||
//prefetch pages when anchors with data-prefetch are encountered
|
||||
$( ".ui-page" ).live( "pageshow.prefetch", function(){
|
||||
$( ".ui-page" ).live( "pageshow.prefetch", function() {
|
||||
var urls = [];
|
||||
$( this ).find( "a:jqmData(prefetch)" ).each(function(){
|
||||
var url = $( this ).attr( "href" );
|
||||
var $link = $(this),
|
||||
url = $link.attr( "href" );
|
||||
|
||||
if ( url && $.inArray( url, urls ) === -1 ) {
|
||||
urls.push( url );
|
||||
$.mobile.loadPage( url );
|
||||
|
||||
$.mobile.loadPage( url, {role: $link.attr("data-" + $.mobile.ns + "rel")} );
|
||||
}
|
||||
});
|
||||
} );
|
||||
});
|
||||
|
||||
$.mobile._handleHashChange = function( hash ) {
|
||||
//find first page via hash
|
||||
|
|
|
|||
Loading…
Reference in a new issue