设为首页 加入收藏

TOP

Struts2如何实现页面分步骤滑动
2014-11-23 17:37:56 】 浏览:275
Tags:Struts2 如何 实现 页面 步骤 滑动

Struts2如何实现页面分步骤滑动


1.在css文件中加入这两个元素:


.fcwindow
{
width:990px;
position:relative;
min-height:400px;
overflow-x:hidden
}


#fccontent
{
position:relative;
width:3960px;
overflow-x:hidden;
}


2.在js文件中加入代码:

fcnext是下一步!


fcup是上一步!


然后fcpArray里面的函数,就是各个步骤触发的函数,自行填写即可。在测试阶段可以:


a = function(){
alert("function a");
}
b = function(){
alert("function b");
}
c = function(){
alert("function c");
}



var fcprocess = 0;// 当前步骤
var fcmaxprocess = 4;// 最大步骤数
var baseMoveLength = 990;// 步骤移动距离
var moveSpeed = 1000;//
var fcpArray = new Array();// 步骤切换时,触发函数


//切换函数
fcpArray.push(a);
fcpArray.push(b);
fcpArray.push(c);



this.fcnext = function(index) {
var left = $("#fccontent").css("left");

var movedis = 0;
if (left == "auto") {
movedis = -baseMoveLength;
} else {
var l = left.length;
var d = left.substr(0, l - 2);
// alert(d+"-"+left);
movedis = new Number(d);
movedis -= baseMoveLength;
// alert(moveid+"ds"+d);
}

$("#fccontent").animate({
left : movedis
}, moveSpeed, function() {
if (index >= 0) {
fcpArray[index]();
}


});
};
this.fcup = function(index) {
var movedis = 0;
var left = $("#fccontent").css("left");
if (left == "auto") {
movedis = 0;
} else {
var l = left.length;
var d = left.substr(0, l - 2);
movedis = new Number(d);
movedis += baseMoveLength;


}


$("#fccontent").animate({
left : movedis
}, moveSpeed, function() {
if (index >= 0) {
fcpArray[index]();
}
});
};


3.效果展示:




】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C++ 工程师面试体验 下一篇8个增强 PHP 程序安全的函数

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目