You could change the .hide()/.show() to be .attr('disabled', 'disabled') and .removeAttr('disabled') respectively.
http://jsfiddle.net/cpradio/qJzfP/5/
| SitePoint Sponsor |


You could change the .hide()/.show() to be .attr('disabled', 'disabled') and .removeAttr('disabled') respectively.
http://jsfiddle.net/cpradio/qJzfP/5/


Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript


Setting a classname wouldn't prevent them from being clicked, by applying the disabled attribute, the user can't invoke the click event.


Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript


When for example the previous link is to be disabled, it can be as easy as setting the class name on the link, and having the click event for that link just return without doing anything.
That way the link doesn't do anything, and the presentation of the link can be styled in any way that is desired.
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
Perfect! I did a mix of both, I used your code cpradio, but then also added a class so I could change the colour, border styling etc:
Thanks again both of you.Code:// if first gallery if ( curGal === 0 ) { //$('button.prev').hide(); $('button.prev').attr('disabled', 'disabled').addClass('disabled'); } else { $('button.prev').removeAttr('disabled').removeClass('disabled'); //$('button.prev').show(); } // if last gallery if ( curGal === galleries.length - 1 ) { //$('button.next').hide(); $('button.next').attr('disabled', 'disabled').addClass('disabled'); } else { $('button.next').removeAttr('disabled').removeClass('disabled'); //$('button.next').show(); } }); // Hide the first gallery //$('button.prev').hide(); $('button.prev').attr('disabled', 'disabled').addClass('disabled');
I also set it so that if there is only one gallery UL, hide the pagination:
Code:if ( galleries.length > 1 ) { $('.paginate').show() } else { $('.paginate').hide() } // Listen for when one of the buttons us clicked $('.paginate').find('button').on('click', function() {
Bookmarks