2011-12-29 48 views
0

我使用2个不同的jquery插件,这两个工作正常,但由于某种原因,我不能让他们一起工作。jquery全屏图像与jquery卷轴

全屏图像:

<script type="text/javascript"> 
    var FullscreenrOptions = { width: 1024, height: 439, bgID: '#bgimg' }; 
    // This will activate the full screen background! 
    jQuery.fn.fullscreenr(FullscreenrOptions); 

</script> 

滚动到DIV功能:

function GotoSection(divid) 
{ 
    $('#realBody').animate({scrollTop: $('#' + divid).offset().top}, 300); 
    } 

我的html:

<!-- This is the background image --> 
<img id="bgimg" src="img/background6.jpg" /> 
<!-- Here the "real" body starts, where you can put your website --> 
<div id="realBody"> 
<div id="header"> 
    <div class="content"> 
     <img src="img/logo.png" align="left"/> 
     <ul id="menu"> 
      <li><a id="mhome" name="home" class="selected" onclick="GotoSection('home');">Home</a></li> 
        </ul> 
      <div class="clear"></div> 
    </div>  
</div> 
<div id="container"> 
    <div id="home" class="seperator"></div> 
      here is my home content 
     </div> 
    </div> 
</div> 

我的CSS:

#bgimg { 
position:absolute; 
z-index: -1; 
} 

#realBody{ 
position:absolute; 
z-index: 5; /* Place the new body above the background image */ 
overflow:auto; /* restore scrollbars for the content */ 
height:100%;width:100%; /* Make the new body fill the screen */ 
top:120px; 
} 


body 
{ 
height: 100%; 
overflow: hidden; 
background-color: #ffffff; 
padding: 0; 
margin: 0; 
font-family:'HelveticaLTStdLight'; 
color:#0f508e; 
} 

滚动是搞砸了,它不会去我发送的div。我认为我的错误是在这一行:

$('#realBody').animate({scrollTop: $('#' + divid).offset().top}, 300); 

但不知道我需要改变它。

回答

0

您的开合div的数量不匹配。尝试纠正这一点,看看它是否修复它。