ECMAScript对文件夹图片幻灯片播放
2024-10-14 08:06:58
代码如下:
var curContext = null;
var curWeb = null;
var picListTitle = "PictureLib";
var folderName = "PictureSlide";
var liTemp = "<li style='background-image: url({0});'></li>"; $(document).ready(function () {
curContext = SP.ClientContext.get_current();
curWeb = curContext.get_web(); ShowSlidePics(); }); function ShowSlidePics()
{
var camlQuery = SP.CamlQuery.createAllFoldersQuery();
//var folderUrl = "/teams/ap1/gctech/DEV/PictureLib/" + folderName+"/"; ///teams/ap1/gctech/DEV
//camlQuery.set_folderServerRelativeUrl(folderUrl);
camlQuery.set_viewXml("<View Scope='RecursiveAll'><Query><Where><Contains><FieldRef Name='FileDirRef'/><Value Type='Text'>/PictureSlide</Value></Contains></Where></Query></View>"); var picList = curWeb.get_lists().getByTitle(picListTitle);
var fileItems = picList.getItems(camlQuery);
curContext.load(fileItems, 'Include(ID, Title, FileRef)');//, FileLeafRef, FileDirRef
curContext.executeQueryAsync(Function.createDelegate(this, onQuerySucceeded), Function.createDelegate(this, onQueryFailed)); function onQuerySucceeded(sender, args) {
var itemInfo = '';
var itemEnumerator = fileItems.getEnumerator(); while (itemEnumerator.moveNext()) {
var item = itemEnumerator.get_current();
itemInfo += liTemp.replace("{0}", item.get_item('FileRef'));
} $("#divBanner ul").html(itemInfo); StartBindSlide();
}
function onQueryFailed(sender, args) {
console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
} function StartBindSlide()
{
$('#divBanner').unslider({
speed: 500, // speed
delay: 3000, // delay
keys: true, // enable Key
dots: true // dots
}); var unslider = $('#divBanner').unslider();
$('.unslider-arrow').click(function () {
var fn = this.className.split(' ')[1];
// Either do unslider.data('unslider').next() or .prev() depending on the className
unslider.data('unslider')[fn]();
});
}
}
最新文章
- CH模拟赛 皇后游戏
- Alpha阶段项目总结
- 如何给CentOS安装字体库
- xcode升级导致git无法使用
- MySQL主从同步报错排错结果及修复过程之:Slave_SQL_Running: No
- python 二叉树
- .net使用FluentValidation进行服务端验证。
- mssql 获取表空间大小
- ping 和 traceroute 命令
- GCD时间轴
- IOS自定义alertview
- 依赖于设备的位图(DDB) ,CreateCompatibleBitmap用法
- extjs最普通的grid
- ubuntu12.04+fuerte 下跑通lsd-slam——数据集
- Jquery实现数据双向绑定(赋值和取值),类似AngularJS
- Eclipse安装JD-Eclipse反编译插件成功看源码
- 22 Notification 通知栏代码
- 【翻译】Ext JS最新技巧——2015-10-21
- SpringMVC学习笔记之一(SpringMVC架构及与Mybatis整合)
- ACM-ICPC 2018 徐州赛区网络预赛 J Maze Designer(最大生成树+LCA)