基于js實現圖片放大拖拽特效



37 144 49



特效描述:基于js實現 圖片放大 拖拽特效,基于js實現圖片放大拖拽特效

代碼結構

1. 引入CSS

<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/style.css">

2. 引入JS

<script type="text/javascript" src="js/drag_map.js"></script>
<script type="text/javascript" src="js/drag_map.js"></script>

3. HTML代碼

?<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <style type="text/css">
        body{font-size: 12px;font-family: "Verdana" , "Arial" , "Helvetica" , "sans-serif";} td{font-size: 12px; line-height: 150%;} TD{font-size: 12px; color: #000000;} A{font-size: 12px; color: #000000;} #Layer1{z-index: 100; position: absolute; top: 150px;} #Layer2{z-index: 1; position: absolute;}
    </style>
    <script type="text/JavaScript">
        function MM_reloadPage(init) {
            if (init == true) with (navigator) {
                if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
                    document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage;
                }
            }
            else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
        }
        MM_reloadPage(true);
    </script>
</head>
<body onLoad="" onmouseup="document.selection.empty()" oncontextmenu="return false"
    onselectstart="return false" ondragstart="return false" onbeforecopy="return false"
    style="overflow-y: hidden; overflow-x: hidden" oncopy="document.selection.empty()"
    leftmargin="0" topmargin="0" onselect="document.selection.empty()" marginheight="0"
    marginwidth="0">
    <div id="Layer1">
        <table cellspacing="2" cellpadding="0" border="0">
            <tbody>
                <tr>
                    <td>&nbsp;
                    </td>
                    <td>
                        <img title="向上" style="cursor: hand" onClick="clickMove('down')" height="20" src="images/up.gif"
                            width="20">
                    </td>
                    <td>&nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        <img title="向左" style="cursor: hand" onClick="clickMove('right')" height="20" src="images/left.gif"
                            width="20">
                    </td>
                    <td>
                        <img title="還原" style="cursor: hand" onClick="realsize();" height="20" src="images/zoom.gif"
                            width="20">
                    </td>
                    <td>
                        <img title="向右" style="cursor: hand" onClick="clickMove('left')" height="20" src="images/right.gif"
                            width="20">
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;
                    </td>
                    <td>
                        <img title="向下" style="cursor: hand" onClick="clickMove('up')" height="20" src="images/down.gif"
                            width="20">
                    </td>
                    <td>&nbsp;
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;
                    </td>
                    <td>
                        <img title="放大" style="cursor: hand" onClick="bigit();" height="20" src="images/zoom_in.gif"
                            width="20">
                    </td>
                    <td>&nbsp;
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;
                    </td>
                    <td>
                        <img title="縮小" style="cursor: hand" onClick="smallit();" height="20" src="images/zoom_out.gif"
                            width="20">
                    </td>
                    <td>&nbsp;
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <p>
        <br>
    </p>
    <div id="hiddenPic" style="z-index: 1; left: 0px; visibility: hidden; width: 0px;
        position: absolute; top: 150px; height: 0px">
        <img src="http://ww2.sinaimg.cn/large/adde8400gw1eeazlmtqa8j20qd0mdadm.jpg" border="0" name="images2">
    </div>
    <div class="dragAble" id="block1" onMouseOver="dragObj=block1; drag=1;" style="z-index: 10;
        left: 0px; width: 0px; position: absolute; top: 150px; height: 0px" onMouseOut=""
        drag="0">
        <img onmousewheel="return onWheelZoom(this)" style="zoom: 0.7" src="images/adde8400gw1eeazlmtqa8j20qd0mdadm.jpg"
            border="0" name="images1">
    </div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>



用戶評論
大牛,別默默的看了,快登錄幫我點評一下吧!:)      登錄 | 注冊


熱門標簽: 拖動 拖拽 拖動插件 拖拽插件 放大縮小 變大變小 放大 縮小 變大 變小 縮放 切換按鈕 縮放切換 表單 表單美化 表單插件 表單美化插件 圖片拖動 圖片拖拽 圖片放大縮小 圖片縮放 圖片大小 圖片放大 圖片縮小 圖片變大 圖片變小 按鈕控制
?
×
×

注冊

官方QQ群

掃描上面二維碼加微信群

官方QQ群

jQuery/js討論群
群號:642649996
Css3+Html5討論群
群號:322131262

加群請備注:從官網了解到

老夫子电子