[英]jQuery not working in JSF(icefaces)
Below is my jasx file where i am including menu.js 以下是我的jasx文件,其中包含menu.js
<head>
<script src="/js/menu.js" type="text/javascript">
</script>
</head>
menu.js menu.js
function initMenu() {
alert("ok");
$('#menu ul').hide();
$('#menu li a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('normal');
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('normal');
checkElement.slideDown('normal',function(){
var offset = $(this).offset();
$('#menu li a').removeClass('selected');
$(this).parent().find('a:first').addClass('selected');
var margin_top = offset.top-210;
$('div#current').animate({'margin-top':margin_top},2000,'easeOutBounce');
});
return false;
}
}
);
}
$(document).ready(function() {initMenu();});
Icefaces also uses the $
variable, so you'll have to use another variable for jQuery scripts. Icefaces还使用
$
变量,因此您必须对jQuery脚本使用另一个变量。 You will redeclare it like this: 您将像这样重新声明它:
var myJQuery = jQuery.noConflict();
and replace all instances of $
with myJQuery
in your jQuery-based scripts. 并在基于jQuery的脚本
myJQuery
$
所有实例替换$
myJQuery
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.