From 3ac023e7a59dba1e91738297f3e1d4b181f06bd8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 18 Nov 2014 11:18:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=82=AC=E6=B5=AE=E6=A1=86=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=B1=8F=E5=B9=95=E7=BB=9D=E5=AF=B9=E5=AE=9A=E4=BD=8D=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E8=B2=8C=E4=BC=BCIE6=E4=B8=8D?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_course_ad.html.erb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/courses/_course_ad.html.erb b/app/views/courses/_course_ad.html.erb index f8b4781f8..efac79afc 100644 --- a/app/views/courses/_course_ad.html.erb +++ b/app/views/courses/_course_ad.html.erb @@ -33,12 +33,11 @@ var xstep=1; // 移动步长,此参数越小,移动越平滑,最小值为1 var delay_time=60; // 每步的时间间隔,此参数越小,移动速度越快 var YY=0; - var screen_height = $(window).height(); //浏览器当前窗口文档的高度 - var screen_width = $(window).width(); //浏览器当前窗口文档的宽度 window.setInterval(function(){move();},delay_time); function move() { + var screen_height = $(window).height(); //浏览器当前窗口文档的高度 var floatpoint_height = $("#floatpoint").height(); YY += xstep; if(YY <= 0){xstep = 1; YY = 0;} //如果浮动层超出了上界,则设定移动方向为向下;并设定层的位置为正好在上界处 @@ -47,9 +46,9 @@ xstep = -1; YY=(screen_height-floatpoint_height); } - $("#floatpoint").css("top",YY); + $("#floatpoint").css("margin-top",YY); } - function change_size(){var body_width = $("#top-menu").width(); $("#floatpoint").css("left",screen_width/2+body_width/2+10);} + function change_size(){var screen_width = $(window).width();var body_width = $("#top-menu").width(); $("#floatpoint").css("left",screen_width/2+body_width/2+10).css("position", "fixed");} $(document).ready(function(){change_size();}); - $(window).resize(function(){screen_width = $(window).width();change_size();}); + $(window).resize(function(){change_size();}); \ No newline at end of file