From 939e4cc100652563584d5541dd18a2f4a3910379 Mon Sep 17 00:00:00 2001 From: yanxd Date: Sat, 26 Apr 2014 09:03:25 +0800 Subject: [PATCH] =?UTF-8?q?footer=20=E4=B8=8B=E6=96=B9=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=20welcome=E8=B0=83=E6=95=B4=E4=B8=8B=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_footer.html.erb | 50 ++++----- app/views/welcome/course.html.erb | 107 +------------------ app/views/welcome/index.html.erb | 134 +----------------------- public/javascripts/welcome.js | 64 +++++++++++ 4 files changed, 94 insertions(+), 261 deletions(-) create mode 100644 public/javascripts/welcome.js diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 0f2334656..faff9e13c 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -1,31 +1,31 @@
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index c91b3e453..0e45ab3ba 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -1,22 +1,11 @@ <%= stylesheet_link_tag 'welcome' %> - - -
-

问题和反馈动态 diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 7a241981a..e41260de1 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -1,22 +1,11 @@ <%= stylesheet_link_tag 'welcome' %> - - -
-
- - - - - - - - -






- -
-
- -
+

diff --git a/public/javascripts/welcome.js b/public/javascripts/welcome.js new file mode 100644 index 000000000..a0166bb3f --- /dev/null +++ b/public/javascripts/welcome.js @@ -0,0 +1,64 @@ +(function () { + window.onload = function(){ + function fixedBar(id, options){ + var ele = document.getElementById(id); + if(!ele) return; + if(/msie (\d+\.\d+)/i.test(navigator.userAgent)){ + var pageHeight=window.innerHeight; + var d=document; + if(typeof pageHeight!="number"){ + if(document.compatMode=="CSS1Compat"){ + pageHeight=document.documentElement.clientHeight; + }else{ + pageHeight=document.body.clientHeight; + } + } + var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop; + if(options.addclass) ele.className = options.addclass; + ele.style.position= 'absolute'; + + if(options.show){ + ele.style.top = 0 + "px"; + ele.style.display= 'block'; + } + + window.attachEvent('onscroll' , function (){ + + var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop; + + ele.style.top = 0 + "px"; + if(options.autoHidden){ + if(ieScrollTop==0){ + ele.style.display="none"; + }else{ + ele.style.display="block"; + } + } + }); + }else{ + var ele = document.getElementById(id); + if(typeof pageHeight!="number"){ + if(document.compatMode=="CSS1Compat"){ + pageHeight=document.documentElement.clientHeight; + }else{ + pageHeight=document.body.clientHeight; + } + } + if(options.show) ele.style.display= 'block'; + ele.style.top = 0 +'px'; + window.addEventListener('scroll',function (){ + if(options.autoHidden){ + if(baidu.page.getScrollTop()==0){ + ele.style.display="none"; + }else{ + ele.style.display="block"; + } + } + },false); + } + } + + fixedBar('backTopBtn' , {autoHidden: true, top : 186}); + fixedBar('identifier-pannel' , {autoHidden: false , top : 956 , show : true}); + } +})(); \ No newline at end of file