zoukankan      html  css  js  c++  java
  • 【荐】JS实现的图片弹性拖动特效代码

    代码简介:

    很有意思的一个JavaScript代码段,鼠标怎么也甩不掉图片,像弹簧一样越甩越远,但就是甩不掉,用好了这一技巧,你就能做出很多漂亮的效果来。

    代码内容:

    View Code
    <HTML>
    <HEAD>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <title>【荐】JS实现的图片弹性拖动特效代码 - www.webdm.cn</title>
    <STYLE>v\:* {
    BEHAVIOR
    : url(#default#VML)
    }
    </STYLE>

    <SCRIPT language=JavaScript1.2>
    var stringcolor="white"
    var ballsrc="http://www.webdm.cn/themes/pic/webdm_logo.gif"
    if (document.all && window.print){
    document.write(
    '<IMG id=Om style="LEFT: -10px; POSITION: absolute" src="'+ballsrc+'">')
    ddx
    =0;ddy=0;PX=0;PY=0;xm=0;ym=0
    OmW
    =Om.width/2;OmH=Om.height/2
    }
    function Ouille(){
    x
    =Math.round(PX+=(ddx+=((xm-PX-ddx)*3)/100))
    y=Math.round(PY+=(ddy+=((ym-PY-ddy)*3-300)/100))
    Om.style.left=x-OmW
    Om.style.top
    =y-OmH
    elastoc.to
    =x+","+y
    elastoc.strokecolor
    =stringcolor
    setTimeout(
    "Ouille()",1)
    }
    function momouse(){
    xm
    =window.event.x+5
    ym
    =window.event.y+document.body.scrollTop+15
    elastoc.from
    =xm+","+ym
    }
    if(document.all && window.print){
    code
    ="<v:line id=elastoc style='LEFT:0;POSITION:absolute;TOP:0' strokeweight='1.5pt'></v:line>"} else {
    code
    ="<v:group style='LEFT:-10;WIDTH:100pt;POSITION:absolute;TOP:0;HEIGHT:100pt' coordsize='21600,21600'><v:line

    id=elastoc style='LEFT:0;WIDTH:100pt;POSITION:absolute;TOP:0;HEIGHT:100pt'

    strokeweight='1.5pt'></v:line></v:group>
    "}
    if(document.all && window.print){
    document.body.insertAdjacentHTML(
    "afterBegin",code)
    document.onmousemove
    =momouse
    Ouille()
    }
    </SCRIPT>
    </head>
    <BODY bgcolor="#000000">
    </BODY>
    </HTML>
    <br />
    <p><a href="http://www.webdm.cn">网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!

    </p>

    代码来自:http://www.webdm.cn/webcode/859c52fe-4f3d-4249-a2bc-6c45ff4da796.html

  • 相关阅读:
    Spring学习8- SSH需要的jar包
    Spring学习8-SSH+Log4j黄金整合
    Spring学习8-Spring事务管理(注解式声明事务管理)
    dbvisualizer客户端执行创建存储过程或自定义函数语句的方法
    jvm的组成入门
    java的反射机制
    oracle排序子句的特殊写法与ORA-01785错误
    javascript的数据类型检测
    jsp的el表达式
    javascript模块化编程的cmd规范(sea.js)
  • 原文地址:https://www.cnblogs.com/webdm/p/2307355.html
Copyright © 2011-2022 走看看