Reputation: 1411
For some reason this way a[href$=.jpg]
this is defined it doesn't work in the new jquery 1.9.1 Is there a way to rewrite this?
$(document).ready(function() {
$("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({
'titlePosition' : 'outside',
'overlayColor' : '#000',
'overlayOpacity' : 0.9
});
});
Upvotes: 2
Views: 175
Reputation: 1273
You may be missing the quotes.
Try using this selector instead:
$("a[href$='.jpg'],a[href$='.png'],a[href$='.gif']")
According to the documentation, the attribute ends with selector can either take quoted strings as the value, or an unquoted single word. The .
character is a non-word character, so the quotes are required in this case.
But it is best practice to maintain consistent code, so it is recommendable to use the quotes all the time (sometimes it doesn't work without quotes, but it works all the time with the quotes. If you use quotes all the time and keep the code consistent, you'll have less problems in the future).
Upvotes: 4
Reputation: 219938
You should quote the attribute values:
$("a[href$='.jpg'],a[href$='.png'],a[href$='.gif']")
Upvotes: 1