[jQuery] jQuery로 만든 롤오버 이미지 소스 > 팁앤테크

본문 바로가기

사이트 내 전체검색

뒤로가기 팁앤테크

[jQuery] jQuery로 만든 롤오버 이미지 소스

본문

롤오버 이미지 스크립트를 jquery로 간단하게 만들어 봤습니다. .menu 안의 링크(<a>)로 싸인 이미지에 마우스오버시 확장자앞에 _r 을 붙이고 마우스아웃시 _r 을 떼는 소스입니다.

<div class="menu">
<a href="#"><img src="http://i1.daumcdn.net/cfs.tistory/static/images/xBoxReplace_250.png" height="250" width="250"></a>
<a href="#"><img src="http://i1.daumcdn.net/cfs.tistory/static/images/xBoxReplace_250.png" height="250" width="250"></a>
<a href="#"><img src="http://i1.daumcdn.net/cfs.tistory/static/images/xBoxReplace_250.png" height="250" width="250"></a>
</div>

<script type="text/javascript">
$(document).ready(function()
{
    $(".menu a img").mouseover(function()
    {
        $(this).attr("src", $(this).attr("src").replace(/(.gif|.jpg|.png)$/, "_r$1"))
    }).mouseout(function()
    {
        $(this).attr("src", $(this).attr("src").replace(/_r(.gif|.jpg|.png)$/, "$1"));
    });
});
</script>
추천0

댓글목록 0

등록된 댓글이 없습니다.

전체 825건 10 페이지
게시물 검색
Copyright (c) 株式会社YHPLUS. All rights reserved.

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒171-0014 東京都豊島区池袋2-41-5 アーバン154 8F
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

PC 버전으로 보기