我怎样才能让它在页面加载后立即运行?
我希望这个 fancyBox 在页面加载后立即运行,而不必单击图像。
在 javascript 代码中我有:
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox({
type : 'image',
maxWidth : 800,
padding : 0,
fitToView : true,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : true,
closeClick : false,
nextEffect : 'none',
closeEffect : 'none',
mousewheel : true
});
});
</script>
谢谢大家!
I want this fancyBox to run as soon as the page has loaded instead of having to click on a image.
In the javascript code i have:
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox({
type : 'image',
maxWidth : 800,
padding : 0,
fitToView : true,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : true,
closeClick : false,
nextEffect : 'none',
closeEffect : 'none',
mousewheel : true
});
});
</script>
Thanks Guys!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设 .fancybox 是有问题的图像,则
$(".fancybox").click()
位于$(document).ready(function() {
的末尾>Assuming that .fancybox is the image in question,
$(".fancybox").click()
at the end of your$(document).ready(function() {
从 文档 中:
其中
your_selector
附加了一个 fancybox,所以在您的情况下,将是.fancybox
。From the documentation:
Where
your_selector
has a fancybox attached to it, so in your case this would be.fancybox
.你可以尝试一个肮脏的黑客,
它看起来像是记录的方式
you can try a dirty hack
it seems like its the documented way