0
我正在使用以下腳本在頭部加載jquery,以防未加載。動態加載jquery
<script type="text/javascript">
if(!window.jQuery)
{
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#nav li:has(ul)").hover(function(){
$(this).find("ul").slideDown();
}, function(){
$(this).find("ul").hide();
});
});
</script>
<style>
#nav {position: fixed; white-space:nowrap;}
#nav ul{ list-style-type:none; margin:0; padding:0; }
#nav li { float:left; padding:0; margin:0;list-style: none;}
#nav li a { width:220px; display:block; text-align:center; color:#000; margin-right:5px; height:35px; line-height:35px; text-decoration:none; font-size:90%; border:1px solid #ccc;text-transform: uppercase;font-weight: bold; }
#nav li a:hover { color:#f00; }
#nav ul ul { display:none; position:absolute; z-index:999; }
#nav li li { float:none; }
#nav li li a { background:#EBE7E6!important; text-align:left; height:auto; line-height:1; width:auto; padding:8px 20px 8px 22px; border:1px solid #D0D0D0; border-top:none; margin-right:0;width: 178px; }
* html li li { display:inline; } /* IE6 Bugfix... */
</style>
但它並沒有出現在腦海中。
有沒有原因您沒有使用腳本標記的src屬性? – 2012-08-13 21:58:47
你是什麼意思:「它沒有出現在腦海中」。你不會在瀏覽器的View/Source中看到它。你的問題到底是什麼? – jfriend00 2012-08-13 22:00:12
不,沒有理由 – lgt 2012-08-13 22:00:23