Change Numeric value to Text value? jQuery Gallery
I really like this jQuery Gallery
However, instead of number开发者_开发知识库s for navigation, I'd like to use words (e.g. Football / Rugby / Athletics).
How do I achieve this?
Many thanks for any pointers.
you could just overwrite them after the gallery is loaded:
$(function(){
// create gallery...
var titles = ['Football', 'Rugby', 'Athletics', 'asdg', '...'];
for(var i=0;i<titles.length;i++){
$('#controls'+(i+1)+' a').html(titles[i]);
}
});
edit: thanks for the fiddle: seems to work :))) http://jsfiddle.net/mHsuU/2/
You'd have to modify the source. On the upside, modifying the source looks pretty straight forward. You want to rename the numericId
option to something like indexId
to reflect its new purpose. Then you'd add a indexLabels
option that takes an array value.
Change this:
if(options.numeric){
html += '<ol id="'+ options.numericId +'"></ol>';
to
if(options.numeric || options.indexLabels){
html += '<ol id="'+ options.indexId +'"></ol>';
And add another branch to this:
if(options.numeric){
for(var i=0;i<s;i++){
//...
}
with something like this:
else if(options.indexLabels) {
// generate the <li>s to match your labels.
}
And make sure you change numericId
to indexId
everywhere. There are a couple other if(options.numeric)
checks that you'd want to change to if(options.numeric || options.indexLabels)
too but not many.
You'd probably want to send a patch to the author as well, that would be polite.
精彩评论