Image rotator question
Image rotator question
Hi,
I have been trying to complete an image rotator tutorial from the Learning jQuery 1.3 book but haven't been able to get past a fairly early step and am wondering if it is because I am using jQuery 1.4.2 or if I have just made a mistake in transcribing the code (I've checked, and for the life of me, I don't see it but stranger things have happened...)
I've looked at it in Safari and Firefox and neither shows it working...
Here is the code:
- $(document).ready(function() {
- var spacing = 220;
- $('#featured-books').css({
- 'width' : spacing * 3,
- 'height' : '220px',
- 'overflow' : 'hidden'
- }).find('.covers').css({
- 'float' : 'none',
- 'position' : 'absolute',
- 'left' : 1000,
- 'overflow' : 'hidden'
- });
- var setUpCovers = function(){
- var $covers = $('#featured-books .covers a');
- $covers.unbind('click');
- //Left image; scroll right (to view images on the left)
- $covers.eq(0).css({'left' : 0}).bind('click', function(event){
- $covers.eq(2).css({'left' : 1000});
- $covers.eq($covers.length - 1).prependTo('#featured-books .covers');
- setUpCovers();
- event.preventDefault();
- });
- //Right image; scroll left (to view images on the left)
- $covers.eq(2).css({'left' : spacing * 2}).click(function(event){
- $covers.eq(0).css({'left' : 1000});
- $covers.eq(0).appendTo('#featured-books .covers');
- setUpCovers();
- event.preventDefault();
- });
- //Center image
- $covers.eq(1).css({'left' : spacing});
- };
- setUpCovers();
- });
The html and css seem to work fine but I can post those as well if it is helpful.
Thanks very much!