Skip to content

Commit

Permalink
Refactored to improve the layout and hide the fade elements if they a…
Browse files Browse the repository at this point in the history
…re not needed
  • Loading branch information
baphled committed Jun 21, 2010
1 parent 071e0ac commit 0bc517f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
5 changes: 4 additions & 1 deletion app/views/common/_sidebar_list_content.html.erb
Expand Up @@ -18,7 +18,10 @@
</ul>
<hr/>
<%else%>
<%= model.class.to_s.singularize %> does not have any <%= assoc %> yet.
<ul>
<li><%= model.class.to_s.singularize %> does not have any <%= assoc %> yet.</li>
</ul>
<hr/>
<% end %>
</li>
<% end %>
Expand Down
34 changes: 18 additions & 16 deletions public/javascripts/autoScroller.js
Expand Up @@ -30,24 +30,26 @@ $.fn.autoScroller = function(options) {
$innerUnorderedList.scrollTop(0);
$("#item-list-top").remove();
$("#item-list-bottom").remove();
$('ul.hover li:visible > hr:first').before("<div id=item-list-top />");
$('ul.hover li:visible > hr:last').before("<div id=item-list-bottom />");
$('body').mouseout(function() {stop = true;}).mouseover(function() {stop = false;});

setInterval(function() {
if (parseInt($('ul.hover li:visible').height()) >= 250) {
$('ul.hover li:visible > hr:first').before("<div id=item-list-top />");
$('ul.hover li:visible > hr:last').before("<div id=item-list-bottom />");
$('body').mouseout(function() {stop = true;}).mouseover(function() {stop = false;});

if (false == stop) {
if ($innerUnorderedList.scrollTop() == previousOffset && null != previousOffset) {
$innerUnorderedList.animate({scrollTop: 0}, 'slow');
previousOffset = null;
} else {
$innerUnorderedList.animate({scrollTop: $innerUnorderedList.scrollTop() + 2}, 5);
}
setInterval(function() {

if (false == stop) {
if ($innerUnorderedList.scrollTop() == previousOffset && null != previousOffset) {
$innerUnorderedList.animate({scrollTop: 0}, 'slow');
previousOffset = null;
} else {
$innerUnorderedList.animate({scrollTop: $innerUnorderedList.scrollTop() + 2}, 5);
}

previousOffset = $innerUnorderedList.scrollTop();

}
}, opts.speed);
previousOffset = $innerUnorderedList.scrollTop();

}
}, opts.speed);
};
}

// private function for debugging
Expand Down

0 comments on commit 0bc517f

Please sign in to comment.