It was a problem with syntax:
slidesjs-index=\""+number+"\""
Is supposed to be
slidesjs\-index\=\""+number+"\""
Such that it's a string, not an expression. Adding escape characters fixed the problem.
Pergunta
I asked this question on the plugin's forums, but I think they are dead, no point. Maybe you can help me.
All I need to do is select the currently viewed slide element, so I can pop a caption over it with .slideToggle()
. What I tried was
callback: {
complete: function(number){
$("#slides").find("slidesjs-index=\""+number+"\"").children(".cap").slideToggle();
}
}
But that returns a syntax error:
Uncaught Error: Syntax error, unrecognized expression: slidesjs-index="2"
Which I presume is because slidesjs-index="(index of the automatically enumerated element)"
is not a valid HTML attribute, so the browser does not accept that script. Can you please suggest some method of selecting the current slide so I can call the callback function to pop the caption over the relevant image?
Is there maybe a way to just search inside the tag name for a matching string and select the element using that?
Solução
It was a problem with syntax:
slidesjs-index=\""+number+"\""
Is supposed to be
slidesjs\-index\=\""+number+"\""
Such that it's a string, not an expression. Adding escape characters fixed the problem.