2
好的,這是交易。我有一個網站,我動態加載所有的內容。我基本上是從其他頁面的內容加載到主頁面上的div。如果我把它去掉所有的函數和花裏胡哨的話,我已經把它縮小到它是.load()函數。每當它執行它時,我的鏈接就會失控,我找不到它。我嘗試搜索,但沒有人似乎有我遇到的問題,但如果我錯過了任何我道歉。這讓我很沮喪,我只想知道它是什麼。jQuery .load()搞砸了我的<a>標籤
JavaScript的
function openContent(x)
{
var q= x+".php #info";
$("#content").load(q,function() { $('#content').mCustomScrollbar({ scrollButtons:{ enable:false} }); });
$("#container").animate({opacity:1.0,width:'890px'},3000);
$('#content').animate({opacity:1.0,width:'890px'},3000);
$('.close').animate({opacity:1.0,},12000);
}
的PHP
<div id="background">
<div id="logo"></div>
<input type="button" class="web-development" onclick="openContent('development')"/>
<input type="button" class="graphic-design" onclick="openContent('graphic-design')" />
<input type="button" class="photography" onclick="openContent('photography')" />
<input type="button" class="projects" onclick="openContent('projects')" />
<input type="button" class="contact" onclick="openContent('contact')" />
<input type="button" class="close" onclick="closeContent()" />
<div id="container" ><div id="content"></div></div>
<div id="footer">Copyright <?php echo date('Y'); ?> ©</div>
</div>
當按鈕被點擊它們加載相應的內容到內容DIV。
的CSS
#background
{
background: url('../Images/background.png') no-repeat;
margin-right:auto;
margin-left:auto;
height:800px;
width:1280px;
}
#logo
{
background: url('../Images/logo.png') no-repeat;
width: 235px;
height: 175px;
z-index: 999;
position:absolute;
top: 10px;
left: 535px;
}
/*container to affect the scroll */
#container
{
background: url('../Images/content_bg.png');
height:650px;
width:1px;
opacity:0.0;
padding: 90px 40px 0px 40px;
position:absolute;
z-index:7;
left:165px;
top:70px;
}
/* deocarting content */
#content
{
background: url('../Images/content_bg.png');
opacity: 0.0;
width:1px;
height:650px;
padding: 0px 0px 0px 0px;
z-index:8;
color:#f4cf00;
/* for IE 5&6&7 opacity hack */
filter: alpha(opacity=0);
font-family:"Gabriola";
font-size:20px;
overflow:auto;
}
/* classes for the buttons on the main page */
.projects
{
position:absolute;
top:160px;
left:425px;
background: url('../Images/projects.png') no-repeat;
width:130px ;
height:640px;
z-index: 2 ;
border: 0px solid;
}
這就是今天的CSS口述內容如何股利和容器定義。就像我說的那樣,如果我不使用加載函數,並且只是手動淡入內容,它就可以工作。使用負載和我的鏈接消失,我必須使用標籤來找到他們
在瀏覽器控制檯中檢查它們並查看可能導致問題的css。聽起來像你可能有一些無效的HTML ...確保頁面和加載內容通過W3C驗證。在隔離問題之前不要直接插入所有插件 – charlietfl 2013-03-16 23:48:41
謝謝!當我加載其他頁面時發現。有一個錨定標籤沒有關閉,導致一切都失靈。我通常使用螢火蟲,並沒有出現任何類型的錯誤。驗證做了訣竅。再次感謝 – 2013-03-17 17:56:25