zoukankan      html  css  js  c++  java
  • javascript 鼠标方式去显示

    document.write("<style type='text/css'>"); 
    document.write(".yyfloat_p{209px; height:396px;position:fixed!important;position:absolute;left:150px;top:80px;_top:expression(offsetParent.scrollTop+offsetParent.clientHeight-600);z-index:788; background:none; }");
    document.write(".yyform_p{150px; height:396px; float:left; background:none; }");
    document.write(".yybar_p{30px; float:left; height:250px; float:left;background:url(/swt/zmd_tcan.gif) left center no-repeat; margin-top:30px;cursor:pointer;} ");
    document.write(".zzsm{349px; height:182px; position:fixed!important;position:absolute;left:-319px;top:350px;_top:expression(offsetParent.scrollTop+offsetParent.clientHeight-350);z-index:800; background:none; }");
    document.write("</style>");
    document.write("<div class="yyfloat_p" id="yyfloat_p">");
    document.write("<div class="yyform_p"><a href="/swt"><img src="/swt/zmd_tc.gif" /></a></div>");
    document.write("<div class="yybar_p"></div>");
    document.write("</div>");
    
    //左侧浮动预约
    $(document).ready(function () { 
       //预约框
        $(".yybar_p").hover(function(){
                $(".yyfloat_p").css("z-index","1420");
                $(".yyfloat_p").stop().animate( { left: '0px' } , 500 ); 
            },function(){  
                hideobj();  
            });  
        /*郑重申明
        $(".zzsm").hover(function(){
                $(".zzsm").stop().animate( { left: '0px' } , 500 ); 
            },function(){  
                $(".zzsm").stop().animate( { left: '-319px' } , 500 );  
            }); */
    });
    //隐藏预约框
    function hideobj() {var xx = new test_out("yyfloat_p");}
     function test_out(id){
        var _this = this, obj = document.getElementById(id);
        this.in_dom = function(m,n){
            if (m==n) return true;
            else if (!m.parentNode) return false;
            else if (m.parentNode==n) return true;
            else return _this.in_dom(m.parentNode,n);
        };
        obj.onmouseout = function(event){
            var e = arguments[0]||window.event;
            var x = e.relatedTarget||e.toElement; // 鼠标滑出的目标元素
            if (!_this.in_dom(x,obj)){ 
                $("#yyfloat_p").stop().animate({left: '-150px'} , 500 ,function(){$(".yyfloat_p").css("z-index","789");});
                
            }
        }
    } 
    zmd_tcan.gif 显示的图片
    zmd_tc.gif 放上去显示的图片(隐藏)
    left: '-150px' 隐藏图片的宽度
  • 相关阅读:
    解决Maven依赖本地仓库eclipse报错的问题
    PowerDesigner连接MySQL和逆向工程图
    《Head First Java》读书笔记(2)
    微信公众号开发 [02] 本地测试环境搭建
    微信公众号开发 [01] 入门基本流程
    IDEA运行编译后配置文件无法找到,或配置文件修改后无效的问题
    log4j的基本使用和参数设定
    06jQuery-06-AJAX
    06jQuery-05-事件
    06jQuery-04-DOM操作
  • 原文地址:https://www.cnblogs.com/suihui/p/3495040.html
Copyright © 2011-2022 走看看