基于jQuery的封装
来源:互联网 发布:对角矩阵的n次方怎么求 编辑:程序博客网 时间:2024/05/16 23:01
/*
*
* index.js
*
*/
;(function ($, window, document, undefined) {
$.extend({
index: function (options) {
//默认值
var defaults = {
nav:"#nav"// 导航id
};
var settings = $.extend({}, defaults, options);
$(settings.nav).on('click','ul>li',function(){
var index = $(this).index();
$(this).addClass('navActive').siblings().removeClass('navActive');
if(index==2){
$(settings.nav).find('ul>li').eq(0).click();
}
});
// 尾部切换函数应用
jQuery('#Slide1').ljSlide({ speed: 500 });
$(".poduct_content_bottom").hide();
$(".product_content_c").hide();
$(".about_list li").hide();
$(".about_jieren").hide();
$(".about_jieren_bt li").hide();
$(".develop_jieren").hide();
$(".develop_jieren_content p").hide();
//$(".client_jieren").hide();
// 滚动条事件
$(window).scroll(function(){
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
var offsetTop = $(".product_intr").offset().top;
var clientTop = offsetTop -scrollTop;
if(clientTop<825){
$(".product_content_c").show();
$(".product_intr").addClass('animated fadeInDown');
$(".poduct_content_top_left").addClass('fadeInLeftBig animated')
$(".poduct_content_top_right").addClass('fadeInRightBig animated ')
$(".poduct_content_top_center").addClass('animated fadeInDown');
} else {
$('.product_intr,.poduct_content_top_left,.poduct_content_top_right,.poduct_content_top_center').removeClass('animated fadeInLeftBig fadeInRightBig fadeInDown fadeInUp');
}
// 档案酷动画
if(clientTop<455){
$(".poduct_content_bottom").show();
$(".poduct_content_bottom_left").addClass('fadeInLeftBig animated');
$(".poduct_content_bottom_right").addClass('fadeInUp animated');
$(".record_span").addClass('fadeInDown animated');
} else{
$('.poduct_content_bottom_left,.poduct_content_bottom_right,.record_span').removeClass('animated fadeInLeftBig fadeInRightBig fadeInDown fadeInUp');
}
// 关于杰人
if(clientTop<280){
$(".poduct_content_bottom").show();
$(".poduct_content_bottom_left").addClass('fadeInLeftBig animated');
$(".poduct_content_bottom_right").addClass('fadeInUp animated');
$(".record_span").addClass('fadeInDown animated');
} else{
$('.poduct_content_bottom_left,.poduct_content_bottom_right,.record_span').removeClass('animated fadeInLeftBig fadeInRightBig fadeInDown fadeInUp');
}
if(clientTop < -331){
$(".about_jieren").show();
$(".about_list li").eq(0).show();
$(".about_list li").eq(1).show();
$(".about_list li").eq(0).addClass('animated fadeInLeftBig');
$(".about_list li").eq(1).addClass('animated fadeInLeftBig');
} else{
$(".about_list li").eq(0).removeClass('animated fadeInLeftBig');
$(".about_list li").eq(1).removeClass('animated fadeInLeftBig');
}
if(clientTop < -535){
$(".about_list li").eq(2).show();
$(".about_list li").eq(3).show();
$(".about_list li").eq(2).addClass('animated fadeInLeftBig');
$(".about_list li").eq(3).addClass('animated fadeInLeftBig');
} else {
$(".about_list li").eq(2).removeClass('animated fadeInLeftBig');
$(".about_list li").eq(3).removeClass('animated fadeInLeftBig');
}
if(clientTop < -725){
setTimeout(function(){
$(".about_jieren_bt li").eq(0).show().addClass('animated fadeInRightBig');
},500);
setTimeout(function(){
$(".about_jieren_bt li").eq(1).show().addClass('animated fadeInRightBig');
},1000);
setTimeout(function(){
$(".about_jieren_bt li").eq(2).show().addClass('animated fadeInRightBig');
},1500);
} else{
$(".about_jieren_bt li").removeClass('animated fadeInRightBig');
}
if(clientTop < -1010){
$(".develop_jieren").show();
$(".develop_jieren_content").addClass('animated fadeInDown');
setTimeout(function(){
$(".develop_jieren_content p").eq(0).show().addClass('animated fadeInLeftBig').show();
},500);
setTimeout(function(){
$(".develop_jieren_content p").eq(1).show().addClass('animated fadeInLeftBig').show();
},1000);
setTimeout(function(){
$(".develop_jieren_content p").eq(2).show().addClass('animated fadeInLeftBig').show();
},1500);
setTimeout(function(){
$(".develop_jieren_content p").eq(3).show().addClass('animated fadeInLeftBig').show();
},2000);
var set5 = setTimeout(function(){
$(".develop_jieren_content p").eq(4).show().addClass('animated fadeInLeftBig').show();
},2500);
} else{
$(".develop_jieren_content p").removeClass('animated fadeInLeftBig');
$(".develop_jieren_content").removeClass('animated fadeInDown');
}
});
}
});
*
* index.js
*
*/
;(function ($, window, document, undefined) {
$.extend({
index: function (options) {
//默认值
var defaults = {
nav:"#nav"// 导航id
};
var settings = $.extend({}, defaults, options);
$(settings.nav).on('click','ul>li',function(){
var index = $(this).index();
$(this).addClass('navActive').siblings().removeClass('navActive');
if(index==2){
$(settings.nav).find('ul>li').eq(0).click();
}
});
// 尾部切换函数应用
jQuery('#Slide1').ljSlide({ speed: 500 });
$(".poduct_content_bottom").hide();
$(".product_content_c").hide();
$(".about_list li").hide();
$(".about_jieren").hide();
$(".about_jieren_bt li").hide();
$(".develop_jieren").hide();
$(".develop_jieren_content p").hide();
//$(".client_jieren").hide();
// 滚动条事件
$(window).scroll(function(){
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
var offsetTop = $(".product_intr").offset().top;
var clientTop = offsetTop -scrollTop;
if(clientTop<825){
$(".product_content_c").show();
$(".product_intr").addClass('animated fadeInDown');
$(".poduct_content_top_left").addClass('fadeInLeftBig animated')
$(".poduct_content_top_right").addClass('fadeInRightBig animated ')
$(".poduct_content_top_center").addClass('animated fadeInDown');
} else {
$('.product_intr,.poduct_content_top_left,.poduct_content_top_right,.poduct_content_top_center').removeClass('animated fadeInLeftBig fadeInRightBig fadeInDown fadeInUp');
}
// 档案酷动画
if(clientTop<455){
$(".poduct_content_bottom").show();
$(".poduct_content_bottom_left").addClass('fadeInLeftBig animated');
$(".poduct_content_bottom_right").addClass('fadeInUp animated');
$(".record_span").addClass('fadeInDown animated');
} else{
$('.poduct_content_bottom_left,.poduct_content_bottom_right,.record_span').removeClass('animated fadeInLeftBig fadeInRightBig fadeInDown fadeInUp');
}
// 关于杰人
if(clientTop<280){
$(".poduct_content_bottom").show();
$(".poduct_content_bottom_left").addClass('fadeInLeftBig animated');
$(".poduct_content_bottom_right").addClass('fadeInUp animated');
$(".record_span").addClass('fadeInDown animated');
} else{
$('.poduct_content_bottom_left,.poduct_content_bottom_right,.record_span').removeClass('animated fadeInLeftBig fadeInRightBig fadeInDown fadeInUp');
}
if(clientTop < -331){
$(".about_jieren").show();
$(".about_list li").eq(0).show();
$(".about_list li").eq(1).show();
$(".about_list li").eq(0).addClass('animated fadeInLeftBig');
$(".about_list li").eq(1).addClass('animated fadeInLeftBig');
} else{
$(".about_list li").eq(0).removeClass('animated fadeInLeftBig');
$(".about_list li").eq(1).removeClass('animated fadeInLeftBig');
}
if(clientTop < -535){
$(".about_list li").eq(2).show();
$(".about_list li").eq(3).show();
$(".about_list li").eq(2).addClass('animated fadeInLeftBig');
$(".about_list li").eq(3).addClass('animated fadeInLeftBig');
} else {
$(".about_list li").eq(2).removeClass('animated fadeInLeftBig');
$(".about_list li").eq(3).removeClass('animated fadeInLeftBig');
}
if(clientTop < -725){
setTimeout(function(){
$(".about_jieren_bt li").eq(0).show().addClass('animated fadeInRightBig');
},500);
setTimeout(function(){
$(".about_jieren_bt li").eq(1).show().addClass('animated fadeInRightBig');
},1000);
setTimeout(function(){
$(".about_jieren_bt li").eq(2).show().addClass('animated fadeInRightBig');
},1500);
} else{
$(".about_jieren_bt li").removeClass('animated fadeInRightBig');
}
if(clientTop < -1010){
$(".develop_jieren").show();
$(".develop_jieren_content").addClass('animated fadeInDown');
setTimeout(function(){
$(".develop_jieren_content p").eq(0).show().addClass('animated fadeInLeftBig').show();
},500);
setTimeout(function(){
$(".develop_jieren_content p").eq(1).show().addClass('animated fadeInLeftBig').show();
},1000);
setTimeout(function(){
$(".develop_jieren_content p").eq(2).show().addClass('animated fadeInLeftBig').show();
},1500);
setTimeout(function(){
$(".develop_jieren_content p").eq(3).show().addClass('animated fadeInLeftBig').show();
},2000);
var set5 = setTimeout(function(){
$(".develop_jieren_content p").eq(4).show().addClass('animated fadeInLeftBig').show();
},2500);
} else{
$(".develop_jieren_content p").removeClass('animated fadeInLeftBig');
$(".develop_jieren_content").removeClass('animated fadeInDown');
}
});
}
});
})(jQuery, window, document);
我们只需要在页面上调用
<script>
jQuery(function($){
$.index();
})
</script>
就可以实现封装,可以让我们更加清楚页面上的属性的含义,使得页面更加简洁
0 0
- 基于jQuery的封装
- 基于jquery的ajax封装
- 基于jquery.ajax的进一步封装
- 项目常见的函数封装,基于Jquery
- 基于jquery封装的一个slider插件
- 基于jQuery封装的滑动条插件
- 基于jquery的ajax方法的二次封装
- 基于JQuery,博客、微博分享代码的封装。
- 基于jquery封装的一个简单web右键菜单
- 基于jquery封装的颜色下拉选择框
- 基于Bootstrap与jQuery-Validate的个人简易封装
- 基于JQuery EasyUI的WebMVC控件封装(含源码)
- 基于MBProgressHUD的封装
- 基于LeanTween的封装
- 基于MessageDigest的封装
- 项目常见函数封装,基于Jquery
- 项目常见函数封装,基于Jquery
- jQuery 的封装方法
- C++内存深度克隆(复制)算法启示录(一)
- 【C语言】如何判断出现内存泄漏
- Springmvc知识一------配置文件&URL&注解组件
- java之实现Cloneable接口的详解,克隆一个对象--对应有浅克隆和深克隆,概念结合代码深入理解
- oracle 11g初学者-day1-oracle的安装下载
- 基于jQuery的封装
- 分享几段获取远程网页内容的php代码。
- Android Studio导入第三方类库的方法
- [BZOJ2916][Poi1997]Monochromatic Triangles(容斥原理+组合数学)
- redis启动失败
- Java本地文件删除和计算文件大小
- IO流
- 关于setInterval循环获取session中的标志位的问题
- Windows 64位下安装Redis详细教程