我是jQuery的新手。我试图转换这个jQuery代码,以便在我的页面中调用.Net Ajax部分回发之后它仍然存在。下面的代码在页面最初加载时运行,但不是在updatePanel中执行回发后运行。使用jQuery .Live来坚持.Net UpdatePanel部分回发不工作
我是否需要在我的代码中的其他地方使用.live功能才能使其工作?
代码:
<script type="text/javascript">
$.noConflict();
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").live('click', (function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
}));
});
</script>
有点困惑,你打电话给'noConflict',然后在那之后使用'$',你说它可以工作...... – 2011-06-06 02:37:14
哦对不起 - 忘了告诉你,我在页面中有另一个jQuery应用程序并不得不使用noConflict来让它工作 – 2011-06-06 04:16:04