SerialScroll_hide-arrows.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*!*****************************************
  2. Snippet for jQuery.SerialScroll
  3. --Hide the arrows when the limit is reached--
  4. Suppose an HTML like this:
  5. ...
  6. <img id="next" src="..." alt="prev" />
  7. <div id="pane">
  8. <img src="..." />
  9. <img src="..." />
  10. <img src="..." />
  11. <img src="..." />
  12. <img src="..." />
  13. </div>
  14. <img id="next" src="..." alt="next" />
  15. ...
  16. You can use <ul>/<li> or any other HTML, just
  17. setup the selectors to match the elements.
  18. *******************************************/
  19. jQuery(function( $ ){
  20. var $prev = $('#prev'),//prev button
  21. $next = $('#next');//next button
  22. $('#pane').serialScroll({
  23. //...
  24. cycle:false, //you probably don't want this
  25. onBefore:function( e, elem, $pane, $items, pos ){
  26. $prev.add($next).show();
  27. if( pos == 0 )
  28. $prev.hide();
  29. else if( pos == $items.length-1 )
  30. $next.hide();
  31. }
  32. //...
  33. });
  34. });
  35. /*!**************************************************************************
  36. Instead of hide and show, you can use fadeIn and fadeOut or whatever you want.
  37. To hide the left arrow when the page loads, use css, or hide it with jQuery
  38. *****************************************************************************/