最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Fancybox Open on Page Load - Stack Overflow

programmeradmin0浏览0评论

I open fancy box on page load. The fancybox loading fine but the external link doesn't open when I click on fancybox.

This is the div I use for fancybox

<div id="inline2" style="display:none;">
<a href="download.php" target="_blank"><img src="images/upgrade.png" border="0" /></a>
</div> <!-- end of inline2 -->

I use this code I use in the page head section

<script type="text/javascript">     
$(document).ready(function() {
$("#inline2").fancybox({ 
'padding':          0,
'cyclic':       true,
'width':        625,
'height':       350,
'padding':      0, 
'margin':      0, 
'speedIn':      300,
'speedOut':     300,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'easingIn':     'swing',
'easingOut':    'swing',
'titleShow' : false
}); 
$("#inline2").trigger('click');
});
</script>

Could somebody please help me how to open the donwnload.php page when I click on fancybox?

Thank you!

I open fancy box on page load. The fancybox loading fine but the external link doesn't open when I click on fancybox.

This is the div I use for fancybox

<div id="inline2" style="display:none;">
<a href="download.php" target="_blank"><img src="images/upgrade.png" border="0" /></a>
</div> <!-- end of inline2 -->

I use this code I use in the page head section

<script type="text/javascript">     
$(document).ready(function() {
$("#inline2").fancybox({ 
'padding':          0,
'cyclic':       true,
'width':        625,
'height':       350,
'padding':      0, 
'margin':      0, 
'speedIn':      300,
'speedOut':     300,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'easingIn':     'swing',
'easingOut':    'swing',
'titleShow' : false
}); 
$("#inline2").trigger('click');
});
</script>

Could somebody please help me how to open the donwnload.php page when I click on fancybox?

Thank you!

Share Improve this question asked Jun 1, 2013 at 6:05 user2442603user2442603 11 silver badge1 bronze badge 3
  • what do you mean with the external link doesn't open when I click on fancybox? does the link open in a new tab? what does fancybox do : does it close? what version of fancybox? – JFK Commented Jun 1, 2013 at 6:52
  • I use fancybox (fancyBox v2.0.6) to show a div when the page is loaded. div is an image. that image has instructions pls download. That image has a download button too. When the visitor click on that button (infact anywhere on that div image) he should go to the download.php. – user2442603 Commented Jun 1, 2013 at 8:59
  • It works when I show fancybox div on the site button click <a href="#inline2" class="fancybox"><img src="images/directions.png" border="0" style="margin-top:10px;margin-left:35px;" /></a>. but when I load the fancybox in pageload it doesn't work. – user2442603 Commented Jun 1, 2013 at 9:30
Add a ment  | 

1 Answer 1

Reset to default 4

Try this script...

$("#inline2").fancybox({ 
'padding':          0,
'cyclic':       true,
'width':        625,
'height':       350,
'padding':      0, 
'margin':      0, 
'speedIn':      300,
'speedOut':     300,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'easingIn':     'swing',
'easingOut':    'swing',
'titleShow' : false
}).trigger('click');
发布评论

评论列表(0)

  1. 暂无评论