HTML/CSS/JAVASCRIPT 강의실

시삽: 레드플러스 님 
게시판 이동:
 제목 : 활용예제 : jQuery를 사용하여, 큰 이미지 보기 기능 구현
글번호: 252
작성자: 레드플러스
작성일: 2009/09/08 오후 6:04:00
조회수: 5410
파일: OnMouseOver.zip (583 KB) / 전송수: 1934
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
    <script type="text/javascript">
        // 아래 코드는 모든 이미지 파일의 이미지명을 얻어,
        // bigs/ 폴더에 있는 동일한 이미지를 div에 보여준다.
        $(document).ready(
            function() {
                $("#product img").mouseover(
                    function() {
                        $("#showImage").show();
                        var imgSrc = "";
                        imgSrc = $(this).attr("src");
                        imgSrc = imgSrc.substr(imgSrc.lastIndexOf("/") + 1);
                        imgSrc = "<img src='ProductImages/bigs/" + imgSrc + "' />";
                        $("#showImage").html(imgSrc);
                    }
                );
                $("img").mouseout(
                    function() {
                        $("#showImage").hide();
                    }
                );
            }
        );
    </script>
    
</head>
<body>

    <div id="product">
        <img src="ProductImages/Book-01.jpg" />

        <img src="ProductImages/Hardware-01.jpg" />

        <img src="ProductImages/Online-01.jpg" />
        
        <div id="showImage" style="border:1px solid red;width:400px;height:400px;">        
        </div>
    </div>

</body>
</html>
 
이전 글   다음 글 삭제 수정 답변 글쓰기 리스트

(댓글을 남기려면 로그인이 필요합니다.)

관련 아티클 리스트
  제       목 파일 작성자 작성일 조회
이전글 (펌) 웹개발자를 위한 표준코딩 개발 가이드 - 레드플러스 2013-01-24 3149
현재글 활용예제 : jQuery를 사용하여, 큰 이미지 보기 기능 구현 OnMouseOver.zip(583 KB) 레드플러스 2009-09-08 5410
다음글 활용예제 : 여러개의 체크박스가 체크되었는지 확인 CheckBoxListCheckConfirm.png(11 KB) 레드플러스 2009-02-02 6273
 
손님 사용자 Anonymous (손님)
로그인 Home