[Jquery][1.4.2][hover] different behavior in firefox and Opera

[Jquery][1.4.2][hover] different behavior in firefox and Opera

I'm using this code with jquery 1.4.2. 

The code works correctly in IE 6,7,8 and Chrome build #(who knows).....

But it doesn't work in Firefox 3.6.3 or Opera 10

The page validates 100% perfect to the dtd and there are no client errors.

The desired behavior is that the gallery will scroll to the right or left when I hover over the respective arrow divs, and when I take the mouse off the div the scrolling should stop. In Chrome and IE the behavior is perfect. In Firefox, there is no scrolling at all, it just stays still.

Can anyone help me out?

thanks,

  1. scrollStep=3

  2. timerLeft=""
  3. timerRight=""

  4. function toLeft(id){
  5.   document.getElementById(id).scrollLeft=0
  6. }

  7. function scrollDivLeft(id){
  8.   clearTimeout(timerRight) 
  9.   document.getElementById(id).scrollLeft+=scrollStep
  10.   timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
  11. }

  12. function scrollDivRight(id){
  13.   clearTimeout(timerLeft)
  14.   document.getElementById(id).scrollLeft-=scrollStep
  15.   timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
  16. }

  17. function toRight(id){
  18.   document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
  19. }

  20. function stopMe(){
  21.   clearTimeout(timerRight) 
  22.   clearTimeout(timerLeft)
  23. }

  24. $(document).ready(function(){
  25.       $(function(){
  26. $('#left_scroll').hover(
  27. function(){
  28. scrollDivRight('gallery_container');
  29. },
  30. function(){
  31. stopMe();
  32. }
  33. );
  34. });
  35. $(function(){
  36. $('#right_scroll').hover(
  37. function(){
  38. scrollDivLeft('gallery_container');
  39. },
  40. function(){
  41. stopMe();
  42. }
  43. );
  44. });
  45. }
Here is the relevant HTML

  
  1. <div id="img_selector" >
  2. <div id="left_scroll" >&larr;</div>
  3. <div id="gallery_container">
  4. <div id="gallery_scroller" >
  5. <div class="image_thumbs"><img style="icon_image" src="http://img227.imageshack.us/img227/950/dontworryoldchapwellgete.jpg" alt="image" id="icon_1233" /></div>
  6. <div class="image_thumbs"><img style="icon_image" src="http://img101.imageshack.us/img101/1286/k717zp1x.jpg" alt="image" id="icon_1221" /></div>
  7. <div class="image_thumbs"><img style="icon_image" src="http://img541.imageshack.us/img541/7857/459598801077970b71c1.jpg" alt="image" id="icon_1220" /></div>
  8. <div class="image_thumbs"><img style="icon_image" src="http://img580.imageshack.us/img580/2694/cutefunnyanimals017rqqt.jpg" alt="image" id="icon_1174" /></div>
  9. <div class="image_thumbs"><img style="icon_image" src="http://img526.imageshack.us/img526/3145/doofus.jpg" alt="image" id="icon_1173" /></div>
  10. <div class="image_thumbs"><img style="icon_image" src="http://img263.imageshack.us/img263/6086/medicomtoyxsillythingbe.jpg" alt="image" id="icon_1169" /></div>
  11. <div class="image_thumbs"><img style="icon_image" src="http://img441.imageshack.us/img441/2858/sillysign263x300.jpg" alt="image" id="icon_1168" /></div>
  12. <div class="image_thumbs"><img style="icon_image" src="http://img714.imageshack.us/img714/6685/7120an20old20silly20fac.jpg" alt="image" id="icon_1167" /></div>
  13. </div>
  14. </div>
  15. <div id="right_scroll" >&rarr;</div>
  16. </div>