jq的hover問題
?$(function(){
? ? ? ? ? ? $("div").hover(
? ? ? ? ? ? ?function(){
? ? ? ? ? ? ? ? $("div").css({"background":"green","color":"yellow"});?
? ? ? ? ? ? ?} ?,
? ? ? ? ? ? ?function(){
? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ?$("div").removeClass("");
? ? ? ? ? ? ?}) ??
? ? ? ? ? ? });
怎么讓離開的時候,添加的css屬性,取消
2016-02-28
用css()方法添加的CSS樣式是行內樣式,
這個時候要讓添加的CSS屬性取消,就需要用removeAttr()方法,移除行內的"style"
2016-02-28
$(function(){
??????????? $("div").hover(
???????????? function(){
??????????????? $("div").css({"background":"green","color":"yellow"});
???????????? }? ,
???????????? function(){
????????????????? $("div").removeAttr("style");
???????????? })
??????????? });
2016-02-28
$("div").onmouseout(
? ? ? ? ? ? ?function(){
? ? ? ? ? ? ? ? $("div").css({""});?
? ? ? ? ? ? ?} ?,