Skip to content

Commit

Permalink
Add back to top button
Browse files Browse the repository at this point in the history
  • Loading branch information
nanlei committed May 9, 2015
1 parent 6fcdf64 commit af5d16a
Show file tree
Hide file tree
Showing 32 changed files with 94 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/article/article.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/article/article_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/contact/contact_dept.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/contact/contact_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</html>
</@p.page>
3 changes: 2 additions & 1 deletion src/main/webapp/Freemarker/front/department/department.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ $(function () {
$dd.eq(0).show();
$dt.eq(0).css('cursor', 'default');
});
</script>
</script>
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/duty/duty_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/index.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ function setTab(name,cursel,n){
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scroll.js"></script>
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
<@p.frontJS />
</@p.page>
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/job/job.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/job/job_article.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/job/job_sublist.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/latest.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/law/law.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/law/law_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/mailbox/mailbox_info.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</html>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/mailbox/mailbox_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</html>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/oa/assetrepair_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</html>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/oa/meeting_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</html>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/oa/overtimemeal_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</html>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/search/search.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/talent/talent.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/talent/talent_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
1 change: 1 addition & 0 deletions src/main/webapp/Freemarker/front/talent/talent_sublist.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
<!--beginning of bottom -->
<@p.bottom/>
<!--end of bottom -->
<script src="${base}/js/scrolltopcontrol.js"></script>
</body>
</@p.page>
4 changes: 3 additions & 1 deletion src/main/webapp/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,6 @@ hr{border:5px solid #e2e2e2; border-width: 0 0 5px 0; margin: 20px 10px 10px 10p
.slider dd{ display:none; border-bottom:1px dashed #fafafa; overflow:hidden;}
.slider dd a{ display:block;padding:0 10px; overflow:hidden;border-bottom:1px solid #e2e2e2; height:26px;line-height:26px;color:#565656}
.slider dd a:hover{background:#efefef;color:#333;}
.slider dd a.on{background:#efefef;color:#333;}
.slider dd a.on{background:#efefef;color:#333;}

#topcontrol{z-index:1000;}
Binary file added src/main/webapp/images/topback.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/main/webapp/js/miniui/miniui.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/webapp/js/miniui/themes/default/miniui.css
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ body .mini-labelfield
}
body .mini-labelfield-checkboxlist
{
width:auto;
width:auto;*zoom:1;
}
.mini-button
{
Expand Down Expand Up @@ -3679,7 +3679,7 @@ body .mini-tree-loading .mini-treegrid-ec-icon
.mini-tree-treeLine .mini-tree-node-ecicon-firstAndlast
{
background-position:50% 50%;
background-image:url(images/tree/lastLine.gif);
background-image:url(images/tree/lastline.gif);
}


Expand Down
57 changes: 57 additions & 0 deletions src/main/webapp/js/scrolltopcontrol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var scrolltotop={
setting:{
startline:100, //起始行
scrollto:0, //滚动到指定位置
scrollduration:400, //滚动过渡时间
fadeduration:[500,100] //淡出淡现消失
},
controlHTML:'<img src="/images/topback.gif" style="width:54px; height:54px; border:0;" />', //返回顶部按钮
controlattrs:{offsetx:30,offsety:10},//返回按钮固定位置
anchorkeyword:"#top",
state:{
isvisible:false,
shouldvisible:false
},scrollup:function(){
if(!this.cssfixedsupport){
this.$control.css({opacity:0});
}
var dest=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto);
if(typeof dest=="string"&&jQuery("#"+dest).length==1){
dest=jQuery("#"+dest).offset().top;
}else{
dest=0;
}
this.$body.animate({scrollTop:dest},this.setting.scrollduration);
},keepfixed:function(){
var $window=jQuery(window);
var controlx=$window.scrollLeft()+$window.width()-this.$control.width()-this.controlattrs.offsetx;
var controly=$window.scrollTop()+$window.height()-this.$control.height()-this.controlattrs.offsety;
this.$control.css({left:controlx+"px",top:controly+"px"});
},togglecontrol:function(){
var scrolltop=jQuery(window).scrollTop();
if(!this.cssfixedsupport){
this.keepfixed();
}
this.state.shouldvisible=(scrolltop>=this.setting.startline)?true:false;
if(this.state.shouldvisible&&!this.state.isvisible){
this.$control.stop().animate({opacity:1},this.setting.fadeduration[0]);
this.state.isvisible=true;
}else{
if(this.state.shouldvisible==false&&this.state.isvisible){
this.$control.stop().animate({opacity:0},this.setting.fadeduration[1]);
this.state.isvisible=false;
}
}
},init:function(){
jQuery(document).ready(function($){
var mainobj=scrolltotop;
var iebrws=document.all;
mainobj.cssfixedsupport=!iebrws||iebrws&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest;
mainobj.$body=(window.opera)?(document.compatMode=="CSS1Compat"?$("html"):$("body")):$("html,body");
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+"</div>").css({position:mainobj.cssfixedsupport?"fixed":"absolute",bottom:mainobj.controlattrs.offsety,right:mainobj.controlattrs.offsetx,opacity:0,cursor:"pointer"}).attr({title:"返回顶部"}).click(function(){mainobj.scrollup();return false;}).appendTo("body");if(document.all&&!window.XMLHttpRequest&&mainobj.$control.text()!=""){mainobj.$control.css({width:mainobj.$control.width()});}mainobj.togglecontrol();
$('a[href="'+mainobj.anchorkeyword+'"]').click(function(){mainobj.scrollup();return false;});
$(window).bind("scroll resize",function(e){mainobj.togglecontrol();});
});
}
};
scrolltotop.init();

0 comments on commit af5d16a

Please sign in to comment.