zoukankan      html  css  js  c++  java
  • 用js实现类似分享到显示效果

    效果在左边的那个蓝色方块:进入显示的时候,会显示“分享到”几个字,鼠标移上,内容会慢慢移出,鼠标移出,内容再慢慢回复原来位置。

    分享到内容 分享到

    这个要点提示部分,在前面的几篇要点中都有提到,这里就不提了。

    下面,直接上代码喽:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="gb2312" />
    <title>无标题文档</title>
    <style>
    body
    {margin:0; padding:0; font:12px/1.5 arial;}
    #share
    {width:100px; height:200px; line-height:200px; text-align:center; border:1p solid #ccc; background:#f5f5f5; position:absolute; left:-100px; top:100px;}
    #share_tit
    {position:absolute; right:-20px; top:60px; width:20px; height:60px; padding:10px 0; background:#06c; text-align:center; line-height:18px; color:#fff;}
    </style>
    <script>
    window.onload
    = function(){
    var share = document.getElementById("share");

    share.onmouseover
    = function(){
    startrun(
    this,0)
    }

    share.onmouseout
    = function(){
    startrun(
    this,-100)
    }

    }

    var timer = null
    var speed = 0;
    function startrun(obj,target){
    clearInterval(timer);
    timer
    = setInterval(function(){

    if(obj.offsetLeft<target){
    speed
    = 10;
    }
    else{
    speed
    = -10;
    }

    if(obj.offsetLeft == target){
    clearInterval(timer);
    }
    else{
    obj.style.left
    = obj.offsetLeft + speed + "px";
    }

    },
    30)
    }
    </script>
    </head>

    <body>

    <div id="share">
    分享到内容
    <span id="share_tit">分享到</span>
    </div>

    </body>
    </html>



  • 相关阅读:
    englis translate,word
    三层架构 业务应用划分
    01 sharepoint 2010开发概述
    项目管理框架,生命周期与组织,管理过程,项目管理知识领,项目经理应具备的技能和素质
    New Text Document.udl
    03 sharepoint 2010 UI 改进
    WCF
    Sharepoint2010学习内容列表介绍
    测试概论,基础,ST评估与质量,ST过程与管理,应用负载压力测试
    ios NSDictionary 操作
  • 原文地址:https://www.cnblogs.com/jingangel/p/2392179.html
Copyright © 2011-2022 走看看