基本信息
源码名称:page slider 的实现
源码大小:0.10M
文件格式:.zip
开发语言:js
更新时间:2014-01-20
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
使用translate 3D实现page slider
function PageSlider(container) { var container = container, currentPage, stateHistory = []; // Use this function if you want PageSlider to automatically determine the sliding direction based on the state history this.slidePage = function(page) { var l = stateHistory.length, state = window.location.hash; if (l === 0) { stateHistory.push(state); this.slidePageFrom(page); return; } if (state === stateHistory[l-2]) { stateHistory.pop(); this.slidePageFrom(page, 'left'); } else { stateHistory.push(state); this.slidePageFrom(page, 'right'); } } // Use this function directly if you want to control the sliding direction outside PageSlider this.slidePageFrom = function(page, from) { container.append(page); if (!currentPage || !from) { page.attr("class", "page center"); currentPage = page; return; } // Position the page at the starting position of the animation page.attr("class", "page " from); currentPage.one('webkitTransitionEnd', function(e) { $(e.target).remove(); }); // Force reflow. More information here: http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/ container[0].offsetWidth; // Position the new page and the current page at the ending position of their animation with a transition class indicating the duration of the animation page.attr("class", "page transition center"); currentPage.attr("class", "page transition " (from === "left" ? "right" : "left")); currentPage = page; } }