我想要做的是使用jquery和ul菜单,然后单击它从外部文件加载部分div并在内容div中显示它们在th部分div我需要此代码来显示它的结果
<script type='text/javascript'>
imvu_avatar_name = "TheDarkRaver";
imvu_panel_name = "rankings_panel";
imvu_section_name = "mp_right";
imvu_panel_width = 320;
imvu_panel_height = 228;
</script>
<script type='text/javascript'
src='http://www.imvu.com/catalog/web_panel_js.php'>
</script>
如果你想看到它的实际行动就去 http://tdr.host22.com/sections.html
并查看我希望他们在哪里展示
指向html和脚本源的链接 my javascript in external html is not loading
答案 0 :(得分:2)
查看您的网站,您可能希望这样做:
将此放在您的页面上,可能是在您的所有其他内容之后
<style>
#hiddenData{display:none;}
</style>
<div id="hiddenData">
<div class="about">About text</div>
<div class="home">Home text</div>
</div>
然后在你的JS文件中放入这些函数(改编自my javascript in external html is not loading):
var GetData = function(id){
return $("#hiddenData > div." + id);
};
$(document).ready( function() {
var sections = $("#menu a");
var loading = $("#loading");
var content = $("#content");
function showLoading() {
loading.css( {
visibility: 'visible',
opacity: 1,
display: 'block'
} );
}
function hideLoading(){
loading.fadeTo(1000, 0);
}
sections.click( function() {
showLoading();
content.slideUp();
GetData(this.id);
hideLoading();
content.slideDown();
} );
} );