Fancybox行为异常?

时间:2014-01-24 09:21:20

标签: jquery fancybox

我在我的网站上使用fancybox,效果很好。我实际上在做的是我打开一个fancybox,当它打开时,我有一个链接打开第二个fancybox。当我点击该链接时,它会打开第二个fancybox,这很好。

第二个fancybox的问题在于,当我最小化Web浏览器并尝试滚动到窗口以查看fancybox的最后一行时。现在,fancybox自动跳转到中心的痛苦,滚动窗口没有任何好处。

如果我最小化第一个fancybox的网络浏览器,那么没有这样的问题,但是第二个fancybox就是这样。为什么会出现这个问题?

这是我的代码:

<head>
<style>
</style>
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script> -->
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<link rel="stylesheet" href="css/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery.fancybox.pack.js?v=2.1.5"></script>

<script type="text/javascript">
    $(document).ready(function(){
        $(".fancybox").fancybox({
        loop        : false,
        maWidth     : 500,
        maxHeight   : 500,
        minWidth    : 500,
        minHeight   : 500,
        autoPlay     :false,
        fitToView   : true,
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',
        prevEffect  : 'none',
        nextEffect  : 'none',



              afterLoad: function() {
              this.title += '<div style="background-color:;width:100%;float:left;"><div style="background-color:;width:40%;float:left;>fdfdg</div><div style="background-color:;width:40%;float:left; onclick="secondfb();"><button>link to another fancybox</button></div></div>'; 

             this.title +='</br>';
              },

              helpers : {

              title: {
              type: 'inside'
              },
              }
              });
              });
function secondfb()
{
$("#vik").fancybox({
        loop        : false,
        maWidth     : 500,
        maxHeight   : 500,
        minWidth    : 500,
        minHeight   : 500,
        autoPlay     :false,
        fitToView   : true,
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',
        prevEffect  : 'none',
        nextEffect  : 'none',



              afterLoad: function() {
             this.inner.prepend( '<div id="emaildiv"><form id="emailform" method="POST"  onsubmit="checkemailform(this);return false;"><div><img src="/images/RentCan.png" height="92px" width="160px" alt="bccondos.net" border="0" style="max-width: 160px;height: auto;"/></br></div><fieldset style=""><div style="width:30%;min-height:100px;float:left;"> First Name <input type="text"name="fname" id="fname" readonly value=""style="width:250px;"></input></span> Last Name <input type="text" name="lname" id="lname" readonly value="" style="width:250px;"></input>  Email <input type="text" style="width:250px;"id="email" readonly value="" name="email"></input>Phone Number<span style="color:red;">*</span><input type="text" style="width:250px;"id="phoneno" name="phoneno"></input></div><div style="width:40%;min-height:100px;float:right;margin-right:5%; ">Comment<textarea  style="min-height:150px;width:250px;" id="rentcanformfeedback" name="rentcanformfeedback"></textarea></div></fieldset><div style="width:100%;float:left;;"><fieldset><span class="fl_n"><center><img id="captcha" src="/securimage/securimage/securimage_show.php"   alt="CAPTCHA Image" /></center><hr>Enter the code above here:<input type="text" name="captcha_code" id="captcha_code" size="10" maxlength="6" /><span id="captchamsg" style="display:none;color:red;">Above  Code not matched Please Try Again!</span> Cannot read the image click <a href="#" onclick="captcha_changeimg()"><b> HERE </b></a>to refresh</span> </fieldset><fieldset><input type="checkbox" name="choices" id="ii" value="ii" >I am interested in this listing and other similar listings<span style="color:red;">*</span><br><p style="margin-left:20px;">Please describe yourself (Choose one)<span style="color:red;">*</span></p><input type="radio" name="choices" id="hmfr" value="hmfr">Help me find a rental.<br><input type="radio" name="choices" id="iwai" value="iwai">I want additional information.<br><input type="radio" name="choices" id="ijc" value="ijc" >I am just curious.<br><input type="radio" name="choices" id="iwpr" value="iwpr">I want to post a rental.<br><br><input type="checkbox" name="cbox12" value="confirmation" id="cbox12">  I confirm that the information I have provided is true and correct and acknowledge that management will suspend my account if my information is found to be false. Click here for our <a href="/Privacy_Policy_Rentcan.html" target="_blank">Privacy Policy</a>. <span style="color:red;">*</span></fieldset></br><input type="submit" value="Send" ></input><br><br></div></form></div>');
             this.title +='</br>';
              },
             helpers : {
             title: {
              type: 'inside'
              },
              }
              }).trigger('click');


}

</script>

</head>
<html>
<a rel="group" class="fancybox" caption="This is 1st caption" href="images/img1.jpg" ><img src="images/img1_thumb.jpg" alt="image1"/></a>
<a rel="group" caption="This is 1st caption2"class="fancybox" href="images/img2.jpg"><img src="images/img2_thumb.jpg" alt="image2"/></a>

<div id="vik"></div>
</html>

0 个答案:

没有答案