解决方案 »
- Jquery实现无限级树状结构并动态添加增删改等编辑功能
- 请问用ExtJs的朋友,qWikiOffice有.Net版本吗?
- 为什么我的window.opener 调用父页面Js里的函数没有作用 父页面是在frame框架里的
- asp里怎么调用别的asp页面中的javascript
- 求个简单的正则
- DreamweaverMX2004自动生成的JAVASCRIPT代码查询日期型字段报错问题
- 以上代码怎么用,能否给个例子
- 怎么实现把同一表单提交到两个处理页面呢,高分重酬!
- 请教:javascript如何动态的删除表单内的控件。急,在线等待。
- 请问用JAVASCRIPT怎样对cookie作操作?
- FullCalendar日历插件 遇到个小问题
- 各位大神,帮忙看下啊
不是,hover也是加active样式,当前页面所属菜单也是有个active样式!,但是不要影响现在有的样式!
不是,hover也是加active样式,当前页面所属菜单也是有个active样式!,但是不要影响现在有的样式! <style>
a{display:inline-block;width:50px;height:40px;}
.active{background:#F00;}
a:hover{background:#0f0;}
</style>
<a href="#" class="active">aaaa</a><a href="#">bbbb</a><a href="#">cccc</a>
不是,hover也是加active样式,当前页面所属菜单也是有个active样式!,但是不要影响现在有的样式! <style>
a{display:inline-block;width:50px;height:40px;}
.active{background:#F00;}
a:hover{background:#0f0;}
</style>
<a href="#" class="active">aaaa</a><a href="#">bbbb</a><a href="#">cccc</a>
额,大哥,我是问怎么JQ实现?不是要您改我的html,而且不能用全局变量
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.active{ border:#00F 1px solid; width:200px; height:20px; margin-top:2px;}
</style>
<script src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("ul li").closest("li").hover(function(){
$(this).css({"border":"1px solid #F00"});
},function(){
$(this).css({"border":"1px solid #00F"});
})
})
</script>
</head>
<body>
<ul>
<li class="active"><a href="javascript:;">监 控 台</a></li>
<li class="active"><a href="javascript:;">模 板 管 理</a></li>
<li class="active"><a href="javascript:;">周 报</a></li></ul>
</body>
</html>
$('ul li.active').siblings().hover(function(){$(this).addClass('active')},function(){$(this).removeClass('active')})应该再加个class
var a=$('ul li');
var ac=$('ul li.active');
a.hover(function(){a.removeClass('active');$(this).addClass('active')},function(){a.removeClass('active');ac.addClass('active')})})($)
var a=$('ul li');
var ac=$('ul li.active');
a.hover(function(){a.removeClass('active');$(this).addClass('active')},function(){a.removeClass('active');ac.addClass('active')})})($)
额,不用全局变量存储原来.active的index();我的问题开始就有声明
var a=$('ul li');
var ac=$('ul li.active');
a.hover(function(){a.removeClass('active');$(this).addClass('active')},function(){a.removeClass('active');ac.addClass('active')})})($)
额,不用全局变量存储原来.active的index();我的问题开始就有声明
没用全局变量,那个是局部的
var a=$('ul li');
var ac=$('ul li.active');
a.hover(function(){a.removeClass('active');$(this).addClass('active')},function(){a.removeClass('active');ac.addClass('active')})})($)
额,不用全局变量存储原来.active的index();我的问题开始就有声明
没用全局变量,那个是局部的
我的想法是不要在hover方法以外声明变量。。