Hey all,

I'm having a trivial problem, yet I've wasted 3 hours trying to solve it.

I have a div, set height, overflow set to hidden. There is alot of content in that div, so it exceeds the overflow, and thus is hidden. I've been trying to implement a simple jquery scroll effect, to scroll the contents of the div up or down.

	<div id="submitted-comments"><?php
$block = module_invoke('chatblock', 'block', 'view', 0);
print $block['content'];
?></div>
<div id="scrollbtns">
  <a id="scrollDown" href="javascript:void(0)"><img src="sites/all/themes/BDC/scrolldown.gif" name="scrolldown" width="11" height="16" class="scroll_up" id="scrolldown" /></a>
	<a id="scrollUP" href="javascript:void(0)"><img src="sites/all/themes/BDC/scrollup.gif" name="scrollup" class="scroll_down" id="scrollup" /></a>
 
	<script type="text/javascript">

  $(document).ready(function(){

$('#scrollDown').click(function () {
      $('#submitted-comments').animate({ scrollTop: "10px" });
    });

  $('scrollUP').click(function () {
      $("submitted-comments").scrollUp("slow");
    });

  
 });
</script>

  </div>

I've tried practically everything out there with the word scroll, been trying for over 3 hours. I have a good example of what I want to do on a site of mine (it's a static site, so I used the mootools framework, 5 mins VS. 3 hours.. hmmm)

http://members.shaw.ca/jtoobymacdonald/faculty.htm and click on the two scroll buttons in the left hand corner of the content. That is exactly what I want to do, except I have to use Jquery :(

Thanks
Jon.

Comments

suryanto’s picture

you can use scrolling div with css:

<div style='width:500px;height:300px;overflow:auto'>
content
</div>
marcvangend’s picture

Maybe this http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12 is what you're looking for?
When solving jQuery problems, always keep in mind that drupal 5.x is shipped with a rather old version of jQuery (to make sure that a core update from 5.0 to 5.7 will not break your site). When I devlop a site which depends on jQuery, I usually start with updating the jQuery version (http://drupal.org/project/jquery_update). The code from link above also requires this update.