Adding optional ?focus=filename to focus a specific image
This commit is contained in:
parent
2bf3b9a229
commit
17c59ef407
1 changed files with 14 additions and 2 deletions
|
|
@ -80,8 +80,17 @@ $(document).ready(function() {
|
|||
var captionElement = document.getElementById(title);
|
||||
return captionElement.innerHTML;
|
||||
}
|
||||
|
||||
$("a.ss").fancybox({
|
||||
var selectedImg = window.location.search;
|
||||
var selectedPos;
|
||||
if (/^\?focus=/.test(selectedImg)) {
|
||||
selectedImg = selectedImg.substring('?focus='.length);
|
||||
$("a.ss").each(function(index) {
|
||||
if (selectedImg == $(this).attr("title")) {
|
||||
selectedPos = index;
|
||||
}
|
||||
});
|
||||
}
|
||||
var gallery = $("a.ss").fancybox({
|
||||
'titlePosition' : 'inside',
|
||||
'transitionIn' : 'elastic',
|
||||
'transitionOut' : 'elastic',
|
||||
|
|
@ -89,6 +98,9 @@ $(document).ready(function() {
|
|||
'easingOut' : 'easeOutQuad',
|
||||
'titleFormat' : formatTitle
|
||||
});
|
||||
if (selectedPos) {
|
||||
$(gallery[selectedPos]).delay(5000).trigger('click');
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue