<script>
$(function(){
$("a.load").click(function (e) {
e.preventDefault();
$("#main").load($(this).attr("href"));
// alert("#"+($(this).attr("id")));
$("."+($(this).attr("class"))).css('border-bottom', 'solid 1px black');
$("."+($(this).attr("class"))).css('background-color', '#F5F5F5');
$("#"+($(this).attr("id"))).css('border-bottom', 'solid 2px white');
$("#"+($(this).attr("id"))).css('background-color', 'white');
});
});
</script>
上面的函数按预期工作,尽管我的一个类的 :hover 属性在调用此函数后停止工作。因此,jQuery 的 CSS 方法似乎覆盖了 :hover 属性。有解决方法吗?
我尝试在函数末尾添加:
$("."+($(this).attr("class"))+":hover").css('border-bottom', 'solid 2px white');
但这无济于事。