How can I disable Previous button on start and Next button on the last slide in jQuery Cycle2 Malsup plugin?

StackOverflow https://stackoverflow.com/questions/21789723

  •  11-10-2022
  •  | 
  •  

Frage

How can I disable the Previous button on the first slide and Next button on the last slide in jQuery Cycle2 Malsup plugin?

I know this question has been answered before for the Cycle "1" plugin (and that it's posted as a demo on malsup's page). But how do I go about implementing it for the Cycle 2 version? I can't seem to find a simple answer anywhere and I'm pathetically too newbie in Javascript to understand the Cycle 2 API page. Could someone help me by showing me a fiddle?

War es hilfreich?

Lösung

This is actually done automatically if you set the data-cycle-allow-wrap option set to false in the cycle HTML. It will add the class disabled to the prev/next control if it is at the beginning/end of the slideshow. Then you just use CSS to style it so it hidden, or grayed out. No extra Javascript needed.

Here is a fiddle example: http://jsfiddle.net/X3kYY/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top