loadmore & scroll
loadmore
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> <div data-role="page">
<div data-role="content">
<ul data-role="listview">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li>18</li>
<li>19</li>
<li class="load-more"><a href="#">Load More</a></li>
</ul>
</div>
</div>
var count = 20,
$loadMore = $('ul').children('.load-more');
$loadMore.bind('click', function () {
var out = [];
for (var i = 0; i < 10; i++) {
out.push('<li>' + (count++) + '</li>');
}
$('ul').append(out.join('')).append($loadMore).listview('refresh');
});
scroll
<div data-role="page">
<div id="header" data-role="header">
<h1>My Title</h1>
</div><!-- /header --> <div data-role="content">
<div class="content-primary">
<ul data-role="listview" id="list">
</ul>
</div>
</div><!-- /content --> <div id="footer" data-role="footer">
<h1>My Footer</h1>
</div><!-- /header --> </div><!-- /page -->
// load test data initially
for (i=0; i < 10; i++) {
$("#list").append($("<li><a href=\"index.html\"><h3>" + i + "</h3><p>z</p></a></li>"));
}
$("#list").listview('refresh'); // load new data when reached at bottom
$('#footer').waypoint(function(a, b) {
// Load some dynamic data with $.ajax
$.ajax({url: "http://api.themoviedb.org/2.1/Movie.search/en/json/23afca60ebf72f8d88cdcae2c4f31866/The Goonies",
dataType: "jsonp",
jsonpCallback: 'successCallback',
async: true,
beforeSend: function() {
$.mobile.showPageLoadingMsg(true);
},
complete: function() {
$.mobile.hidePageLoadingMsg();
},
success: function (result) {
ajax.parseJSONP(result);
},
error: function (request,error) {
//alert('Network error has occurred please try again!');
}
});
$('#footer').waypoint({
offset: '100%'
});
}, {
offset: '100%'
}); $('#index').live('pagebeforeshow',function(e,data){ }); var ajax = {
parseJSONP:function(result){
//var jsonObj = jQuery.parseJSON(parameters);
$("#list").append('<li>Movie name:<span> ' + result[0].original_name+ '</span></li>');
$("#list").append('<li>Popularity:<span> ' + result[0].popularity + '</span></li>');
$("#list").append('<li>Rating:<span> ' + result[0].rating+ '</span></li>');
$("#list").append('<li>Overview:<span> ' + result[0].overview+ '</span></li>');
$("#list").append('<li>Released:<span> ' + result[0].released+ '</span></li>');
$("#list").listview('refresh');
}
}
loadmore & scroll的更多相关文章
- loadmore
实例点击 loadmore.js /* * loadmore.js require jQuery,artTemplate * Butterfly 2013.08.28 */ define(['../u ...
- 移动端效果之LoadMore
写在前面 列表一直是展示数据的一个重要方式,在手机端的列表展示又和PC端展示不同,毕竟手机端主要靠滑.之前手机端之前一直使用的IScroll,但是IScroll本身其实有很多兼容性BUG,想改动一下需 ...
- vue loadMore 上拉刷新不能实现的坑
1.如果你写的代码没问题,但依然不能实现上拉刷新效果,那你有可能是缺少了overflow: scroll 2.如果上拉刷新一直在加载状态,需要调用this.$refs.loadmore.onBotto ...
- mint-ui loadmore使用方法和注意事项
最好按照github里的例子ctrl+c => v 模版.js mint-ui/example/pages/pull-up.vue 注意设置:mt-loadmore组件:auto-fill='a ...
- vue2 mint-ui loadmore(下拉刷新)
<template> <div class="page-loadmore"> <h1 class="page-title"> ...
- 移动端使用mint-ui loadmore实现下拉刷新上拉显示更多
前序:在使用vue做一个h5项目的时候,需要上拉分页加载,实践中总结一下: 首先要安装mint-ui npm i mint-ui -S 然后引入,一般在main.js里面 import Vue fro ...
- mint-ui之Loadmore使用
<template> <div class="page-loadmore"> <div class="page-loadmore-wrapp ...
- weex图片加载更多方法loadmore的使用
首先,放一个weex中loadmore使用的demo,可以看一下http://dotwe.org/vue/8dd2a10c69e149ae8971f8298cc8bebf 1.在list标签上添加 @ ...
- vue2 mint-ui loadmore(下拉刷新,上拉更多)
<template> <div class="page-loadmore"> <h1 class="page-title"> ...
随机推荐
- UVA 11021 - Tribles(概率)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=481&page=s ...
- 在mac中怎么显示隐藏文件夹
缺省情况下,在 Mac 下是不显示隐藏文件的,Finder 也未提供设置是否显示隐藏文件的选项,不像 Windows 下,有一个“文件夹选项“设置界面里可以控制,但这并不表示 Mac 下无法显示隐藏文 ...
- 3.x vector的用法
#include<vector> //struct struct GOLD_STRUCT { Sprite * goldspSprite; int goldValue; ...
- SharePoint移动客户端--Rshare 中的Smart Cache
Rshare中的Smart Cache 能好好的帮助那些移动客户,当网络信号不好或者没有wifi的时候,cache大有可为,只要你在上飞机执勤cache 了相关文档,你就可以在飞行模式下继续你的工作. ...
- Delphi推出Delphi XE4支持IOS开发
Delphi 新推出 Delphi XE4 ,这是一个支持 iOS 应用开发的新版本.Delphi XE4 带来 Embarcadero 全新的 ARM 编译器 下载地址
- 自己动手写一个简单的(IIS)小型服务器
因为第一次在博客园发表随笔,不太会用,这个笔记是我之前在印象笔记中写好的,然后直接copy过来,有兴趣自己做一个IIS服务器的小伙伴们可以参照下面的流程做一次,也可以叫我要源代码,不过要做完,我觉得花 ...
- getOutputStream() has already been called for this response异常的原因和解决方法
今天在调试一个小web项目时,验证码不显示了,而且后台报错 getOutputStream() has already been called for this response 经过查找得知: 在t ...
- Android系统简介(上):历史渊源
上个月,看到微信的一系列文章,讲到Linux的鼻祖-李纳斯的传记<Just for Fun>, 其人神乎其能, 其人生过程非常有趣,值得每个程序员细细品味. 而实际上,对我而已,虽然做软件 ...
- CSS3几个速记标签2
@font-face:CSS3允许使用自己的字体,用户会自动下载 语法:@font-face{font-family:---:src:url(---)} 如果要使用粗体,必须新添加另一 ...
- HDU 3943 K-th Nya Number(数位DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3943 题目大意:求出区间 (P,Q] 中找到第K个满足条件的数,条件是该数包含X个4和Y个7 Samp ...