我使用Shadowbox并且工作正常。但我不喜欢在点击图像(href)后打开它,需要在页面加载时自动打开它。
我可以改变什么来做到这一点?
这是HTML
<div id="images">
<a href="resources/certified_training/1.png" rel="shadowbox[certifiedtraining];width=510;height=372">Image -1</a>
<a href="resources/certified_training/2.png" rel="shadowbox[certifiedtraining];width=510;height=372">Image -2</a>
<a href="resources/certified_training/3.png" rel="shadowbox[certifiedtraining];width=510;height=372">Image -3</a>
<a href="resources/certified_training/4.png" rel="shadowbox[certifiedtraining];width=510;height=372">Image -4</a>
<a href="resources/certified_training/5.png" rel="shadowbox[certifiedtraining];width=510;height=372">Image -5</a>
</div>
这里是 JavaScript
window.onload = function () {
loadShadowbox();
};
function loadShadowbox() {
Shadowbox.init({
showOverlay: false
});
window.Shadowbox.setDimensionsOld = window.Shadowbox.setDimensions;
window.Shadowbox.setDimensions = function (height, width, maxHeight, maxWidth, topBottom, leftRight, padding, preserveAspect) {
var S = window.Shadowbox;
window.Shadowbox.setDimensionsOld(height, width, maxHeight, maxWidth, topBottom, leftRight, padding, preserveAspect);
window.Shadowbox.dimensions.top = 340;
window.Shadowbox.dimensions.left = 430;
return window.Shadowbox.dimensions;
}