jsとjqサスペンションに新しいclassを追加
902 ワード
html:
this is test!
css:
Way1:
js:
$(function(){
var sign=document.getElementById("sign");
changBkColor(sign);
});
function changBkColor(obj){
obj.onmouseover=function(){ this.className="over"; };//
obj.onmouseout=function(){ this.className="out"; };//
obj.onmousedown=function(){this.className="down";};//
}
Way2:(JQuery)
/* $(obj).hover(inFunction,outFunction)
* $(obj).mouseover().mouseout();
*/
$(function(){
$('#sign').hover(function() {
$('#sign').addClass('over');
}, function() {
$('#sign').removeClass('over').addClass('out');
});
});