자바스크립트 롤오버좀 도와주세여 ㅠㅠ

· 11년 전 · 2000 · 4

 

웹디자인을 하고있는 사회 초년생 입니다.ㅠ

이미지 위에 마우스를 올리면 over.png  요런이미지가 뜨면서 기존 이미지 위에 투명하게 덮이게 하고 싶어요 ㅠㅠ(쿠팡 가격표 이미지위에 롤오버 되듯이요)

 

아직 가야할 길이 많은데 벌써부터 뙇뙇 막히네요 ㅠㅠ 고수님들 도와주세요 ㅠㅠ 

|

댓글 4개

여러가지 방법이 있는데 가장 쉬운 방법은 jquery mouseover 이벤트를 이용하는 겁니다.
구글에서 jquery mouseover 이벤트를 검색해 보세요.
제이쿼리 mouseenter

http://search.naver.com/search.naver?where=nexearch&query=mouseenter&sm=top_sug.pre&fbm=1&acr=1&acq=mouseen&qdt=0&ie=utf8
jquery의 .hover() 메소드를 이용하는 방법도 있습니다.^^

페이지에 <script src="http://code.jquery.com/jquery-latest.min.js"></script> 를 넣어주시고요..
아래 소스를 활용해서 만들어보셔요~

<script>
$(document).ready(function(){
$('div.마우스올릴div명').hover(
function()
{
$("img.아이콘이미지클래스명").show();
},
function()
{
$("img.아이콘이미지클래스명").hide();
});
});
</script>



http://sir.co.kr/bbs/board.php?bo_table=pg_tip&wr_id=10977&sca=&sfl=wr_subject%7C%7Cwr_content&stx=hover
여기에도 소스가 있네요..
발코딩 한번 해봤습니다. 돌아갈진 모르겠네요.
$(function(){
var $overimg = $("<img>").addClass('over').attr('src','http://kinimage.naver.net/20140924_232/1411549767211aizkB_PNG/over.png').css('opacity',0.5);
var $target = $("#main_logo").parent();
$target.hover(
function(){
var t_w = $target.find("img").width();
var t_h = $target.find("img").height();

$overimg.css({
'height':t_h,
'width':t_w
})
$target.append($overimg)
}
,function(){
$(".over").remove();
}

)

})
댓글을 작성하시려면 로그인이 필요합니다. 로그인

자유게시판

+
제목 글쓴이 날짜 조회
11년 전 조회 1,261
11년 전 조회 2,351
11년 전 조회 3,155
11년 전 조회 1,116
11년 전 조회 3,888
11년 전 조회 1,725
11년 전 조회 1,804
11년 전 조회 1,308
11년 전 조회 1,254
11년 전 조회 1,096
11년 전 조회 1,406
11년 전 조회 1,640
11년 전 조회 2,053
11년 전 조회 2,879
11년 전 조회 2,001
11년 전 조회 1,144
11년 전 조회 2,586
11년 전 조회 1,348
11년 전 조회 1,578
11년 전 조회 1,326
11년 전 조회 3,152
11년 전 조회 1,135
11년 전 조회 1,179
11년 전 조회 1,694
11년 전 조회 1,160
11년 전 조회 1,229
11년 전 조회 1,953
11년 전 조회 1,813
11년 전 조회 1,259
11년 전 조회 1,233
🐛 버그신고