728x90
๋ฐ์ํ
๋ง์ฐ์ค ์ค๋ฒ ํ์ ๋ ์ด๋ฏธ์ง ํ์ผ๋ช _on, _off ์ผ๋ก ๋ณ๊ฒฝํ๊ธฐ
mouseover
mouseout
replace ์ฌ์ฉ
$(".target").mouseover(function(){
var imgsrc=$(this).find("img").attr("src");
imgsrc=imgsrc.replace("_off","_on");
$(this).find("img").attr("src",imgsrc);
}).mouseout(function(){
var imgsrc=$(this).find("img").attr("src");
imgsrc=imgsrc.replace("_on","_off");
$(this).find("img").attr("src",imgsrc);
});
$(".target").hover(function(){
$(this).attr("src", $(this).attr("src").replace(".png", "_on.png"));
}, function(){
$(this).attr("src", $(this).attr("src").replace("_on.png", ".png"));
});
๋ฐ์ํ
'js' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
bxslider ์ฌ์ฉ๋ฒ ๋ฐ ์ต์ ๋ชจ์ (0) | 2019.02.11 |
---|---|
jquery - select option ์ ํ๊ฐ ๊ฐ์ ธ์ค๊ธฐ/ ๊ฐ ์ฝ๊ธฐ (0) | 2019.02.11 |
click event ํ๋๋ง (0) | 2019.01.23 |
jq ์ฒดํฌ๋ฐ์ค ํด๋ฆญ ์ด๋ฒคํธ์ input (0) | 2019.01.18 |
์คํฌ๋กค์ ํ๋ฉ๋ด ์๋จ์ ๊ณ ์ (0) | 2019.01.15 |