Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add 'Back to top button'

  • Loading branch information...
commit 43c5ba9d8f7e23bb7da661e815b1126938e995ea 1 parent f073071
den-plugins authored
3  app/views/task_boards/show.html.erb
@@ -252,6 +252,7 @@
252 252 <% end %>
253 253 </tbody>
254 254 </table>
  255 +<div id="back_to_top">Back to top</div>
255 256 <%= javascript_include_tag 'fixedtableheader', :plugin => 'scrum_task_board' %>
256 257 <%= javascript_include_tag 'jquery.colorbox-min.js', :plugin => 'scrum_task_board' %>
257 258 <%= javascript_include_tag 'jquery.jqplot.js', :plugin => 'redmine_burndown' %>
@@ -308,8 +309,6 @@
308 309 });
309 310 }
310 311 }
311   -</script>
312   -<script type='text/javascript'>
313 312 //===========TOOLTIP===========
314 313 var tip;
315 314 jQuery(".tooltip").hover(function(){
6 assets/javascripts/fixedtableheader.js
@@ -21,7 +21,7 @@ jQuery(function( $ ){
21 21 // 'Recreate' the table header since attributing a thead with position: fixed causes empty <td>s to lose their width
22 22 var jmark = jQuery( "#task_board thead" );
23 23 var jheader = jQuery( "#fixed_table_header" );
24   -
  24 + var jbtt = jQuery("#back_to_top");
25 25 var count = 0;
26 26 var leftInit = jheader.offset().left;
27 27
@@ -66,11 +66,13 @@ jQuery(function( $ ){
66 66 if (viewTop > markTop)
67 67 {
68 68 jheader.show();
  69 + jbtt.fadeIn();
69 70 }
70 71 // Check to see if the view has scroll back up above the message
71 72 else if (viewTop <= markTop)
72 73 {
73 74 jheader.hide();
  75 + jbtt.fadeOut();
74 76 }
75 77 // Allow the fixed header to scroll horizontally
76 78 jheader.offset({
@@ -101,6 +103,8 @@ jview.resize(function(){
101 103 jQuery("#task_board").bind('DOMNodeInserted DOMNodeRemoved', function(event) {
102 104 th_adjust();
103 105 });
  106 +
  107 + jbtt.click(function(){ jQuery("body").animate({scrollTop: 0}, 100) });
104 108 });
105 109 // script modified from http://www.bennadel.com/blog/1810-Creating-A-Sometimes-Fixed-Position-Element-With-jQuery.htm
106 110
19 assets/stylesheets/task_board.css
@@ -392,3 +392,22 @@ ul.condensed li {display: inline-block; margin-right: 1px; }
392 392
393 393 .effortLabel { font-weight: normal;color: #666;font-size: 95%; }
394 394
  395 +#back_to_top {
  396 + position: fixed;
  397 + right: 10px;
  398 + bottom: 4px;
  399 + text-align: center;
  400 + border: 1px solid #999
  401 + padding: 8px 10px;
  402 + background: white;
  403 + cursor: pointer;
  404 + font-weight: bold;
  405 + display:none;
  406 + box-shadow: 1px 1px 1px #CCC;
  407 +}
  408 +
  409 +#back_to_top:hover {
  410 + border-color: #ccc;
  411 + color: #999;
  412 +}
  413 +

0 comments on commit 43c5ba9

Please sign in to comment.
Something went wrong with that request. Please try again.