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);
|
var captionElement = document.getElementById(title);
|
||||||
return captionElement.innerHTML;
|
return captionElement.innerHTML;
|
||||||
}
|
}
|
||||||
|
var selectedImg = window.location.search;
|
||||||
$("a.ss").fancybox({
|
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',
|
'titlePosition' : 'inside',
|
||||||
'transitionIn' : 'elastic',
|
'transitionIn' : 'elastic',
|
||||||
'transitionOut' : 'elastic',
|
'transitionOut' : 'elastic',
|
||||||
|
|
@ -89,6 +98,9 @@ $(document).ready(function() {
|
||||||
'easingOut' : 'easeOutQuad',
|
'easingOut' : 'easeOutQuad',
|
||||||
'titleFormat' : formatTitle
|
'titleFormat' : formatTitle
|
||||||
});
|
});
|
||||||
|
if (selectedPos) {
|
||||||
|
$(gallery[selectedPos]).delay(5000).trigger('click');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue