mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-03 20:34:42 +00:00
Continued work on fetchlink logic, using “infinite scroll” demo page to test listview enhancement.
This commit is contained in:
parent
4491d5151c
commit
edc85c711b
4 changed files with 60 additions and 16 deletions
|
|
@ -1,5 +1,5 @@
|
|||
.ui-listview { margin: 0; counter-reset: listnumbering; }
|
||||
.ui-content .ui-listview { margin: -15px; }
|
||||
.ui-content .ui-listview { margin: 0 -15px -1px 0; }
|
||||
.ui-content .ui-listview-inset { margin: 1em 0; }
|
||||
.ui-listview, .ui-li { list-style:none; padding:0; }
|
||||
.ui-li, .ui-li.ui-field-contain { display: block; margin:0; position: relative; overflow: visible; text-align: left; border-width: 0; border-top-width: 1px; }
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
<li>Demos</li>
|
||||
<li><a href="fetch-tabs.html">Fetch Tabs</a></li>
|
||||
<li><a href="infinite-scroll.html">Infinite Scroll</a>
|
||||
|
||||
<li><a href="pix-1.html">Pix 1</a></li>
|
||||
<li><a href="pix-2.html">Pix 2</a></li>
|
||||
|
|
|
|||
37
docs/pages/fetchlinks/infinite-scroll.html
Normal file
37
docs/pages/fetchlinks/infinite-scroll.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>jQuery Mobile Framework - Dialog Example</title>
|
||||
<link rel="stylesheet" href="../../../css/themes/default/" />
|
||||
<link rel="stylesheet" href="../../_assets/css/jqm-docs.css"/>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
||||
<script src="../../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
|
||||
<script src="../../_assets/js/jqm-docs.js"></script>
|
||||
<script src="../../../js/"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div data-role="page">
|
||||
<div data-role="content">
|
||||
<h2>Infinite Scroll</h2>
|
||||
|
||||
<ul data-role="listview" data-inset="true" class="infinite">
|
||||
<li><a href="index.html"><img src="../../lists/images/gf.png" alt="France" class="ui-li-icon">France <span class="ui-li-count">4</span></a></li>
|
||||
<li><a href="index.html"><img src="../../lists/images/de.png" alt="Germany" class="ui-li-icon">Germany <span class="ui-li-count">4</span></a></li>
|
||||
<li><a href="index.html"><img src="../../lists/images/gb.png" alt="Great Britain" class="ui-li-icon">Great Britain <span class="ui-li-count">0</span></a></li>
|
||||
<li><a href="index.html"><img src="../../lists/images/fi.png" alt="Finland" class="ui-li-icon">Finland <span class="ui-li-count">12</span></a></li>
|
||||
<li><a href="index.html"><img src="../../lists/images/sj.png" alt="Norway" class="ui-li-icon">Norway <span class="ui-li-count">328</span></a></li>
|
||||
<li><a href="index.html"><img src="../../lists/images/us.png" alt="United States" class="ui-li-icon">United States <span class="ui-li-count">62</span></a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<a href="../../lists/lists-icons.html" data-role="button" data-method="append" data-target=".infinite" data-fragment=".content-primary [data-role='listview'] li">Load More…</a>
|
||||
|
||||
</div><!-- /content -->
|
||||
</div><!-- /page -->
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -24,7 +24,7 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
|
|||
if ( threshold ) {
|
||||
|
||||
for( var ml = methods.length, i = 0; i < ml; i++ ){
|
||||
if( el.is( "[data-include='" + methods[ i ] + "']" ) ){
|
||||
if( el.is( "[data-method='" + methods[ i ] + "']" ) ){
|
||||
method = methods[ i ];
|
||||
}
|
||||
}
|
||||
|
|
@ -37,10 +37,10 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
|
|||
|
||||
targetEl.ajaxStart(function(){
|
||||
var $el = $(this);
|
||||
|
||||
|
||||
$el
|
||||
.addClass('ui-loading-inline')
|
||||
.trigger('inlineLoader')
|
||||
.trigger('inlineLoader', { method: method })
|
||||
.height( $el.height() );
|
||||
});
|
||||
|
||||
|
|
@ -60,16 +60,20 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
|
|||
normalizePath( 'img', 'src' );
|
||||
normalizePath( 'a', 'href');
|
||||
|
||||
setTimeout(function() {
|
||||
targetEl[ method ]( responseEl.addClass('fade in') );
|
||||
|
||||
setTimeout(function() {
|
||||
responseEl
|
||||
.trigger( "create" )
|
||||
.trigger( "fetchlink", { target : targetEl, data: responseEl });
|
||||
|
||||
.trigger( "fetchlink", { target : targetEl, data: responseEl })
|
||||
.trigger('create' );
|
||||
|
||||
targetEl[ method ]( responseEl.addClass('fade in') );
|
||||
|
||||
$(":jqmData(role='page')").trigger( "create" );
|
||||
|
||||
|
||||
targetEl
|
||||
.removeClass('ui-loading-inline')
|
||||
.height('auto');
|
||||
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
|
|
@ -80,12 +84,14 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
|
|||
}
|
||||
});
|
||||
|
||||
$( document ).bind( "inlineLoader", function( e ){
|
||||
$( e.target ).children().removeClass('fade in').addClass('fade out');
|
||||
|
||||
setTimeout(function() {
|
||||
$( e.target ).html( "<div class='ui-loader-inline fade in'><span class='ui-icon ui-icon-loading spin'></span></div>" );
|
||||
}, 300);
|
||||
$( document ).bind( "inlineLoader", function( e, ui ){
|
||||
if( ui.method === "html" ) {
|
||||
$( e.target ).children().removeClass('fade in').addClass('fade out');
|
||||
|
||||
setTimeout(function() {
|
||||
$( e.target ).html( "<div class='ui-loader-inline fade in'><span class='ui-icon ui-icon-loading spin'></span></div>" );
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
|
||||
//auto self-init widgets
|
||||
|
|
|
|||
Loading…
Reference in a new issue