试图理解这个jQuery,我发现了2个脚本我想使用,但我可以将它们合并为1吗?目前我有他们都在不同的脚本标签。我如何将2 jQuery合并为1
这是第一个脚本
$(function(){
$('#navigation_horiz').delay(100).fadeIn(100);
$('#navigation_horiz').naviDropDown({
dropDownWidth: 'auto', //the default width of drop down elements
slideDownDuration: 600, //easing duration for slideDown
slideUpDuration: 300 //easing duration for slideUp
});
});
这里是第二个脚本
if (franchise_id==undefined) { //hide commish nav is not signed into site
var franchise_id;
document.write("<style type='text/css'>");
document.write("#navigation_horiz ul li.commish { display: none; }");
document.write("</style>");
}
else if (franchise_id=="0000") { } //show commish nav is logged in as commish
else { // hide both if logged in as any other franchise
document.write("<style type='text/css'>");
document.write("#navigation_horiz ul li.commish { display: none; }");
document.write("</style>");
}
试图把在同一...下面,而不是在例如所有
$(function(){
$('#navigation_horiz').delay(100).fadeIn(100);
$('#navigation_horiz').naviDropDown({
dropDownWidth: 'auto', //the default width of drop down elements
slideDownDuration: 600, //easing duration for slideDown
slideUpDuration: 300 //easing duration for slideUp
});
});
if (franchise_id==undefined) { //hide commish nav is not signed into site
var franchise_id;
document.write("<style type='text/css'>");
document.write("#navigation_horiz ul li.commish { display: none; }");
document.write("</style>");
}
else if (franchise_id=="0000") { } //show commish nav is logged in as commish
else { // hide both if logged in as any other franchise
document.write("<style type='text/css'>");
document.write("#navigation_horiz ul li.commish { display: none; }");
document.write("</style>");
}
});
是的,是的,你可以。 :) – adamb 2013-03-21 14:54:16
任何你不能把它们放在同一脚本标记下的原因?您并不仅限于您知道的每个标签的一项功能。 – DiMono 2013-03-21 14:55:03
顺便说一句,第二个是不是甚至jQuery – 2013-03-21 15:02:22