Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a namedPager option #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions responsiveslides.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"speed": 500, // Integer: Speed of the transition, in milliseconds
"timeout": 4000, // Integer: Time between slide transitions, in milliseconds
"pager": false, // Boolean: Show pager, true or false
"namedPager": false, // Boolean: Show named pager (by img alt), true or false
"nav": false, // Boolean: Show navigation, true or false
"random": false, // Boolean: Randomize the order of the slides, true or false
"pause": false, // Boolean: Pause on hover, true or false
Expand Down Expand Up @@ -198,6 +199,27 @@
}
}

// namedPager
if (settings.namedPager && !settings.manualControls) {
var tabMarkup = [];
$slide.each(function (i) {
var n = i + 1;
var currentSlideClass = slideClassPrefix + i;
tabMarkup +=
"<li>" +
"<a href='#' class='" + currentSlideClass + "'>" + $('#' + currentSlideClass + ' img').attr('alt') + "</a>" +
"</li>";
});
$pager.append(tabMarkup);

// Inject pager
if (options.navContainer) {
$(settings.navContainer).append($pager);
} else {
$this.after($pager);
}
}

// Manual pager controls
if (settings.manualControls) {
$pager = $(settings.manualControls);
Expand Down