From 5f6f937fcb5b810507db5e5d440cb37ff623b309 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 7 May 2015 14:38:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=A1=B6=E9=83=A8=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E4=B8=8D=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework.html.erb | 57 +++++++++++++++---- .../homework_attach/_homeworks_list.html.erb | 2 +- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 0272f2c63..02a68a961 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -60,16 +60,53 @@ ); } - $(window).scroll(function(){ - //获取窗口的滚动条的垂直位置 - var s = $(window).scrollTop(); - //当窗口的滚动条的垂直位置大于页面的最小高度时,让返回顶部元素渐现,否则渐隐 - if( s > 600){ - $("#gotoTop").fadeIn(100); - }else{ - $("#gotoTop").fadeOut(200); - }; - }); +// $(window).scroll(function(){ +// //获取窗口的滚动条的垂直位置 +// var s = $(window).scrollTop(); +// //当窗口的滚动条的垂直位置大于页面的最小高度时,让返回顶部元素渐现,否则渐隐 +// if( s > 600){ +// $("#gotoTop").fadeIn(100); +// }else{ +// $("#gotoTop").fadeOut(200); +// }; +// }); + + var Sys = {}; + var ua = navigator.userAgent.toLowerCase(); + var s; + (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : + (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] : + (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] : + (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] : + (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0; + + function goTopEx() { + var obj = document.getElementById("goTopBtn"); + var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; + function getScrollTop() { + var xsun = document.documentElement.scrollTop; + if (Sys.chrome) { + xsun=document.body.scrollTop; + } + return xsun; + } + function setScrollTop(value) { + if (Sys.chrome) { + document.body.scrollTop = value; + } + else { + document.documentElement.scrollTop = value; + } + } + window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; }; + obj.onclick = function () { + var goTop = setInterval(scrollMove, 10); + function scrollMove() { + setScrollTop(getScrollTop() / 1.1); + if (getScrollTop() < 1) clearInterval(goTop); + } + } + }
diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 08ea9434d..a2466d482 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -36,7 +36,7 @@ <% end %>
-
+