0
我有隱藏/顯示div的鏈接的頁面設置。最後一個鏈接是聯繫表單。聯繫表格是超級混亂的代碼,所以我想加載文件外部如何將html加載到隱藏的div中?
我發現很多片段簡單地加載到div div與jquery。但問題是我已經有jquery安裝程序來顯示和隱藏div
我該如何讓聯繫人鏈接顯示聯繫人div並將外部聯繫人窗體加載到它中?
$(document).ready(function() {
$('.menu').click(function() {
var $clicked = $(this)
$('.menu').each(function(){
var $menu = $(this);
if (!$menu.is($clicked))
{
$($menu.attr('data-item')).hide();
}
});
$($clicked.attr('data-item')).toggle();
});
\t \t $(".contactmenu").click(function(){
\t $("#menu-contact").load("contactform.htm");
\t });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<header>
<div align="center" class="logoclass" id="logo"><img src="media/logo.png"/></div>
<div id="topmenu">
<a href="#" id="home-menu-item" class="menu" data-item="#menu-home">Home</a>
<a href="#" id="videos-menu-item" class="menu" data-item="#menu-videos">Videos</a>
<a href="#" id="follow-menu-item" class="menu" data-item="#menu-follow">Follow</a>
<a href="#" id="contact-menu-item" class="menu" data-item="#menu-contact">Contact</a>
</div>
</header>
<article>
<div id="bodycontent">
<div id="menu-contact" style="display: none">Contact</div>
<div id="menu-follow" style="display: none">Follow</div>
<div id="menu-videos" style="display: none"><br />
<div id="videos" style="z-index:1" onClick="document.getElementById('sitemusic').pause();"><br />
<div align="center" id="videobox">Splash
<video style="z-index:-1;" width="400" controls>
<source src="media/videos/splash.mp4" type="video/mp4">
<source src="media/videos/splash.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
</div>
</div>
</div>
<div id="menu-home" style="display: none">..</div>
</div>
</article>
活網站http://shadextracks.com所以你可以看到什麼,我試圖做 –
如果你想讓它做很多事情,那就把多個代碼放在那裏。問題是什麼? – musefan
它沒關係,它是隱藏的或不是 –