Cycle plugin with multiple instances on one page: how to show active image?
I have a page with multiple instances of the jquery cycle plugin that are each controlled with their own pager. I want to figure out how I can identify what the current (or "active") image is and have that page identifier stay as color #333333 (same as the hover state).
JQUERY:
- $(document).ready(function() {
- $('.pics').each(function() {
- var $nav = $('<div class="nav"></div>').insertAfter(this);
- var $this = $(this);
- $this.cycle({
- fx: 'fade',
- speed: 300,
- timeout: 0,
- pager: $nav,
- });
- });
- });
CSS/HTML:
- .nav { margin: 0; float: right; }
- .nav a { background-color: #ffffff; }
- .nav a:hover { background-color: 333333; }
- <div class="pics">
- <img src="img/sample.gif" width="470" height="260"/>
- <img src="img/sample2.gif" width="470" height="260"/>
- <img src="img/sample3.gif" width="470" height="260"/>
- </div>