jquery边框特效
来源:互联网 发布:网络客服沟通技巧 编辑:程序博客网 时间:2024/06/05 04:32
主要思想
1.将四个div分别定位到大div的上下左右位置2.分别设置成宽度为0或者高度为03.让其执行给定动画,即多少毫秒让宽度或者高度变为指定的长度
html代码
<div class="box"> <div class="border_top"></div> <div class="border_bottom"></div> <div class="border_left"></div> <div class="border_right"></div></div>
css代码
.box{ width:234px; height:300px; position:relative;}.border_bottom,.border_left,.border_right,.border_top{ background: #ff6700; position: absolute; font-size: 0px; transition: all 0.5s ease-out; z-index: 99;}.border_bottom,.border_top{ height: 1px; width: 0px;}.border_right,.border_left{ height: 0px; width: 1px;}.border_top { top:0px; left:0px;}.border_right { top:0px; right:0px;}.border_bottom { right: 0px; bottom: 0px;}.border_left { left: 0px; bottom: 0px;}
js实现效果
1.引入jquery文件
<script src="jquery-1.8.3.min.js"></script>
2.jquery代码
$('.main>li').hover(function(){ var index=$(this).index(); $(".border_top").stop(true,true); $(".border_left").stop(true,true); $(".border_bottom").stop(true,true); $(".border_right").stop(true,true); $(".border_top").eq(index).animate({width:"234px"},100) $(".border_left").eq(index).animate({height:"300px"},100) $(".border_bottom").eq(index).animate({width:"234px"},100) $(".border_right").eq(index).animate({height:"300px"},100)},function(){ var index=$(this).index(); $(".border_top").stop(true,true); $(".border_left").stop(true,true); $(".border_bottom").stop(true,true); $(".border_right").stop(true,true); $(".border_top").eq(index).animate({width:"0"},100) $(".border_left").eq(index).animate({height:"0"},100) $(".border_bottom").eq(index).animate({width:"0"},100) $(".border_right").eq(index).animate({height:"0"},100)});
阅读全文
0 0
- jquery边框特效
- 边框特效
- jquery特效
- jquery 特效
- jquery 特效
- jquery特效
- jQuery特效
- Jquery特效
- Jquery特效
- JQuery 特效
- JQuery特效
- jquery特效
- 设置文字边框的方法 文字带边框的特效
- css3实现的图片边框阴影特效
- 鼠标悬浮 边框动态出来特效
- jquery 内边框设置
- 10款jquery特效
- jquery鼠标拖动特效
- 【路在脚下】----成长的感觉
- localstorage跨域存储读取数据
- Ubuntu 16.04LTS 安装pycharm
- 微服务架构浅谈(一)
- 根据underscore精简的函数(集合篇)
- jquery边框特效
- 洛必达法则与泰勒公式
- adb server didn't ack问题
- codeforces 794C Naming Company(贪心)
- java循环语句的学习
- 字节对齐导致的地址计算错误
- CentOS查看内核版本,位数,版本号
- 说说Javaweb 服务器与Tomcat源代码解析
- 中断的概念及意义