网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

html+css+javascript实现跟随鼠标移动显示选中效果的方法

这篇文章主要介绍了html+css+javascript实现跟随鼠标移动显示选中效果 的方法,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

目前创新互联公司已为1000+的企业提供了网站建设、域名、虚拟空间、网站托管、企业网站设计、墨竹工卡网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

1,显示效果:

html+css+javascript实现跟随鼠标移动显示选中效果 的方法

2,html结构


                
                                     
                            
  • End customer get product1 
  •                         
  • Log in EFOSE website and present installation or maintenance requirements 2
  •                         
  • EFOSE prefer contact service point3 
  •                         Customer contact service point to get service4                          
  • Customer pays the bill directly or EFOSE pays the maintenance cost5 
  •                     
                    
                
                         

3,主要的css样式

.line-lpu{ height:55px; position:relative; width:100%; overflow:hidden;}
    .line-lpu span{ width:43px; height:46px; background:url('https://www.efose.com/images/banners/lpu_03.png') no-repeat; position:absolute;top:0;}
    .border-lpu{border-bottom:1px  solid #959595; height:23px; }
     .join-lpu li{ width:19%; float:left; margin-right:8px;background:none; padding:0; }
    .join-lpu li a{ display:block; color:#606060; text-decoration:none; border:1px solid #959595; min-height:215px; padding:10px;position:relative; overflow:hidden;} 
    .join-lpu li a:hover{border:1px solid #337ab7;}
    .join-lpu li b{ font-size:60px; position:absolute; bottom:7px; right:-1px; font-style:italic; color:#c7c7c7;}
    .clear{clear:both;}
    .step-lpu span{ background:url('https://www.efose.com/images/banners/icon-lpu.png') no-repeat; display:block; width:75px; height:65px; margin-left:28px;}
    .step-lpu .icon0{ background-position:0 0;}
    .step-lpu .icon1{ background-position:0 -70px;}
    .step-lpu .icon2{ background-position:0 -140px;}
    .step-lpu .icon3{ background-position:0 -204px; height:58px; margin-bottom:7px;}
    .step-lpu .icon4{ background-position:0 -260px;}

4,JavaScript的编写


        //实例化animationHover对象
        window.onload = function(){
            var ah = new animationHover();  
            ah.init();
        }; 
        //初始化标签对象
        function animationHover(){
            this.step = document.getElementById('step');
            this.stepLi = this.step.getElementsByTagName('li');
            this.line = document.getElementById('line');
            this.attr = null;
            this.timer = null;
            this.target = null;
                            
            }
        //初始化事件
        animationHover.prototype.init=function(){
            This =this;
            for(var i=0;i0?Math.ceil(speed):Math.floor(speed); 
                            //防止取整引起的抖动
                if(target==attrValue) clearInterval(timer); 
                            //如果到达目标点,关闭定时器
                else{
                    obj.style.left=attrValue+speed+'px';
                }
                },100);
                                    
            };
        //获取当前标签对象的css属性值
        animationHover.prototype.getStyle =function(obj,attr){                    
            if(obj.currentStyle){                
                return obj.currentStyle[attr];
            }else{
                return getComputedStyle(obj,false)[attr];
            }
            };    

感谢你能够认真阅读完这篇文章,希望小编分享的“html+css+javascript实现跟随鼠标移动显示选中效果 的方法”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!


网站栏目:html+css+javascript实现跟随鼠标移动显示选中效果的方法
分享链接:http://bjjierui.cn/article/gegidg.html

其他资讯