滚动栏改进,table切换,使广告随滚动条滚动
来源:互联网 发布:如何制作淘宝店铺模板 编辑:程序博客网 时间:2024/06/06 03:22
//用脚本使广告随滚动条滚动window.onload=initial;window.onscroll=move;var objAdver;//层对象var objTop;//头部var objLeft;//左边function initial(){ objAdver=document.getElementById("right");//广告层对象 if(objAdver.currentStyle){//IE浏览器取层的位置:头部位置与左边位置 objTop=parseInt(objAdver.currentStyle.top); objLeft=parseInt(objAdver.currentStyle.left); }else{//非IE浏览器取层的位置方式 objTop=parseInt(document.defaultView.getComputedStyle(objAdver,null).top); objLeft=parseInt(document.defaultView.getComputedStyle(objAdver,null).left); }}function move(){//滚动条移动事件 //重新设置广告层的位置 objAdver.style.top=objTop+parseInt(document.documentElement.scrollTop)+"px"; objAdver.style.left=objLeft+parseInt(document.documentElement.scrollLeft)+"px";}$(document).ready(function(){ //弹出广告 window.open("open.html"); //用样式使广告随滚动条滚动 //$("#right").css("position","fixed"); //点击滚动广告的X可以关闭广告 $(".dd_close").click(function(){ $("#right").css("display","none"); }); //轮换显示广告 //给数字栏1加一个默认样式 $("#scroll_number li:first").addClass("scroll_number_over"); //轮换横幅广告图片 var isscroll=false; var index=1; setInterval(function(){ if(isscroll) return; $("#scroll_img li:visible").hide(); $("#scroll_img li:eq("+index+"):hidden").show(); $("#scroll_number li:eq("+index+")").addClass("scroll_number_over"); $("#scroll_number li:eq("+(index-1)+")").removeClass("scroll_number_over"); index++; if(index==6){ index=0;} },1500); //鼠标移动至数字栏改变样式 $("#scroll_number li").hover( function(){ isscroll=true; index=parseInt(($(this).text())-1); $("#scroll_number li").removeClass("scroll_number_over"); $("#scroll_number li:eq("+index+")").addClass("scroll_number_over"); $("#scroll_img li:visible").hide(); $("#scroll_img li:eq("+index+"):hidden").show(); }, function(){ isscroll=false;}); //鼠标移动至图片,停止 $("#scroll_img").hover( function(){ isscroll=true}, function(){isscroll=false }); //TAB切换 $("#history").mouseover(function(){ $(this).addClass("book_type_out").siblings().removeClass("book_type_out"); $("#book_history:hidden").show().siblings().hide(); }); $("#family").mouseover(function(){ $(this).addClass("book_type_out").siblings().removeClass("book_type_out"); $("#book_family:hidden").show().siblings().hide(); }); $("#culture").mouseover(function(){ $(this).addClass("book_type_out").siblings().removeClass("book_type_out"); $("#book_culture:hidden").show().siblings().hide(); }); $("#novel").mouseover(function(){ $(this).addClass("book_type_out").siblings().removeClass("book_type_out"); $("#book_novel:hidden").show().siblings().hide(); }); //滚动栏 var b=true; var marginTop =0; setInterval(function(){ if(isscroll) return;//判断运行和停止 $("#express li:first").animate({marginTop:marginTop--},0,function(){ var $f = $(this); if(!$f.is(":animated")) { //判断是否有一个动画节点 if (marginTop<0 && b) { //开始移动时,并且b为true时执行 $li = $f.clone(); //克隆一个节点 $li.css("margin-top","0px"); //重新设置样式 $li.appendTo($("#express")); //把新克隆的节点复制到后面去 b=false; //b为false } } if((-marginTop)>=$f.height()){ $("#express li:first").remove(); //移出去后删除 b=true; //b为true marginTop=0; //重新设置margTop为0; } }); },100); //滚动栏 //var marginTop=0; //setInterval(function(){ // $("#express li:first").animate({marginTop:marginTop--},10,function(){ // if(!($(this).is(":animated"))){ // if((-marginTop)>$(this).height()){ // $(this).css("margin-top", "0px"); // $(this).appendTo($("#express")); //把第一个节点移到ul后面 // marginTop = 0; // } // } // }); //},10); $("#express").mouseover(function(){ //li鼠标移入,停止移动 isscroll=true; }); $("#express").mouseout(function(){ isscroll=false; }); //Tab鼠标移至图片和文字给它加样式 $("#book_history dd").hover( function(){$(this).css("background","#ccc");}, function(){$(this).css("background","none"); });});
0 0
- 滚动栏改进,table切换,使广告随滚动条滚动
- 广告不随滚动条的滚动而滚动
- Table水平滚动条
- table 显示 滚动条
- Table水平滚动条
- table div 滚动条
- table滚动条
- Table显示滚动条
- 客服服务、广告随滚动条滚动(通用)
- 网页右侧的漂浮广告代码,随滚动条滚动
- 网页右侧的漂浮广告代码,随滚动条滚动
- 元素随滚动条滚动特效(广告,标题栏等)
- 滚动条滚动,广告保持位置不变
- 随滚动条浮动的广告
- 随鼠标上下滚动的广告条
- 图片随滚动条滚动
- 层随滚动条滚动
- 滚动广告条的制作
- 产生冠军 (拓扑排序)
- anroid 游戏初步 Bitmap 渲染与操作
- Objective-C 的动态提示和技巧
- pipe()函数
- c#如何跨越线程调用窗体上的控件(转)
- 滚动栏改进,table切换,使广告随滚动条滚动
- 有关WebView的一些使用方法
- 51nod----1433 0和5
- AngularJS:如何使用自定义指令来取代ng-repeat
- 火箭鼠的控制脚本
- 圆图片
- iOS知识---针对多个显示内容空间不定内容长度的显示问题Content Hugging 和 Content Compression Resistance
- Mac 更新系统后无法正常启动
- AndroidManifest.xml文件配置详解