博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JS框架_(JQuery.js)Tooltip弹出式按钮插件
阅读量:4354 次
发布时间:2019-06-07

本文共 5947 字,大约阅读时间需要 19 分钟。

 

 

百度云盘    密码:7eh5

 

弹出式按钮效果

 

  
jQuery实现Tooltip弹出样式的分享按钮DEMO演示
index.html

 

.share .close, .close {  width: 20px;  height: 20px;  z-index: 3;  color: white;  border-radius: 50%;  background-color: #00243d;  cursor: pointer;  font-size: .9em;  transition: 200ms opacity 400ms;}.share {  position: relative;  text-align: left;}.share .tooltip {  position: absolute;  top: -195px;  left: 0;  padding: 10px;  box-shadow: 0 8px 13px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(0, 0, 0, 0.06);  background-color: #017ED5;  border-bottom: 2px solid #00243d;  border-radius: 3px;  opacity: 0;  visibility: hidden;  transition: all 200ms ease-in-out, visibility 0ms;  transform-origin: bottom center;}.share .tooltip:before, .share .tooltip:after {  content: "";  display: block;  width: 0;  height: 0;  position: absolute;  left: 30px;  bottom: -28px;  z-index: 3;  border: solid 15px transparent;  border-top-color: #017ED5;  right: auto;}.share .tooltip:after {  bottom: -31px;  z-index: 2;  border-top-color: #00243d;}.show.share .tooltip {  display: block;  visibility: visible;  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1);  animation: wobble 700ms;  opacity: 1;}.share .close {  text-align: center;  position: absolute;  top: -10px;  left: -10px;  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);}.share {  list-style: none;  display: inline-block;}.share.show .footer-nav-link {  background-color: rgba(180, 181, 183, 0.5);}.share .tooltip {  padding: 0;  padding-bottom: 15px;  padding-top: 10px;}.share li {  list-style: none;  display: block;  width: 100%;}.share li a {  display: block;  width: 100%;  padding: 25px 25px;  font-size: .75em;  box-sizing: border-box;}.share li a:hover {  background-color: rgba(180, 181, 183, 0.5);}a.button {  display: inline-block;  text-decoration: none;  letter-spacing: .1em;  text-transform: capitalize;  color: white;  background-color: #b4b5b7;  padding: 15px 20px;  border-radius: 2px;  font-weigth: 700;}.close {  position: absolute;  top: -10px;  left: -10px;  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);}.share {  list-style: none;  display: inline-block;}.share.show .footer-nav-link {  background-color: rgba(0, 36, 61, 0.5);}.share li {  list-style: none;  display: block;  width: 100%;}.share li a {  display: block;  position: relative;  width: 100%;  padding: 15px 25px;  padding-left: 50px;}.share li a:hover {  background-color: rgba(180, 181, 183, 0.5);}a {  display: inline-block;  text-decoration: none;  letter-spacing: .1em;  text-transform: capitalize;  color: white;}a.button {  display: inline-block;  text-decoration: none;  letter-spacing: .13em;  text-transform: capitalize;  color: white;  transition: all 200ms;  background-color: rgba(68, 70, 76, 0.3);  padding: 10px 13px;  border-radius: 2px;}body {  text-align: center;  padding-top: 230px;  background: #c9b23d;}@keyframes wobble {  0% {    transform: scale(0) rotate(-54deg) translatey(40px);  }  45% {    transform: scale(1.1) rotate(20deg) translatey(0px);  }  60% {    transform: scale(1) rotate(-15deg) translatey(0px);  }  77% {    transform: scale(1) rotate(10deg) translatey(0px);  }  100% {    transform: translatey(0);  }}.share a:after {  display: block;  position: absolute;  left: 25px;  top: 50%;  transform: translateY(-50%) translateX(-50%);  width: 7px;  height: 15px;  background-size: 100%;  content: '';  background-repeat: no-repeat;}.share a.twitter-share:after {  width: 15px;  height: 10px;}.share a.email-share:after {  width: 12px;  height: 9px;}
style.css

 

实现过程

 

css

 

@keyframes:创建动画

@keyframes wobble {  0% {    transform: scale(0) rotate(-54deg) translatey(40px);  }  45% {    transform: scale(1.1) rotate(20deg) translatey(0px);  }  60% {    transform: scale(1) rotate(-15deg) translatey(0px);  }  77% {    transform: scale(1) rotate(10deg) translatey(0px);  }  100% {    transform: translatey(0);  }}

 

 

创建动画是通过逐步改变从一个CSS样式设定到另一个。在动画过程中,您可以更改CSS样式的设定多次。指定的变化时发生时使用%,或关键字"from"和"to",这是和0%到100%相同。0%是开头动画,100%是当动画完成。为了获得最佳的浏览器支持,您应该始终定义为0%和100%的选择器。
@keyframes规则

 

transform:属性向元素应用 2D 或 3D 转换。该属性允许我们对元素进行旋转、缩放、移动或倾斜  参数属性:

  scale():定义缩放比例

  rotate(angle) 定义 2D 旋转,在参数中规定角度

  translateY(y) 定义转换,只是用 Y 轴的值

 

按钮样式

a.button {  display: inline-block;  text-decoration: none;  letter-spacing: .1em;  text-transform: capitalize;  color: white;  background-color: #b4b5b7;  padding: 15px 20px;  border-radius: 2px;  font-weigth: 700;}

 

text-decoration:属性规定添加到文本的修饰

  none 默认。定义标准的文本  underline    定义文本下的一条线  overline    定义文本上的一条线  line-through    定义穿过文本下的一条线  blink    定义闪烁的文本
none 默认 定义标准的文本

 

letter-spacing :属性增加或减少字符间的空白(字符间距)

 

text-transform属性,可以轻易地实现英文字母大小写转换

  capitalize; 单词首个字母大写

  uppercase; 全部大写

  lowercase; 全部小写

 

 

font-weight:设置三个段落的字体的粗细

 

分享框样式

.share .tooltip {  position: absolute;  top: -195px;  left: 0;  padding: 10px;  box-shadow: 0 8px 13px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(0, 0, 0, 0.06);  background-color: #017ED5;  border-bottom: 2px solid #00243d;  border-radius: 3px;  opacity: 0;  visibility: hidden;  transition: all 200ms ease-in-out, visibility 0ms;  transform-origin: bottom center;}

 

box-shadow: h-shadow v-shadow blur spread color inset

  h-shadow 必需的。水平阴影的位置。允许负值

  v-shadow 必需的。垂直阴影的位置。允许负值

  blur 可选。模糊距离

  spread 可选。阴影的大小

  color 可选。阴影的颜色

  inset 可选。从外层的阴影(开始时)改变阴影内侧阴影

 

border-bottom:设置下边框的样式

  border-bottom-width

  border-bottom-style 
  border-bottom-color

 

opacity:设置 div 元素的不透明级别

visibility:属性规定元素是否可见

transition :属性是一个简写属性,用于设置四个过渡属性

  transition-property 规定设置过渡效果的 CSS 属性的名称。

  transition-duration 规定完成过渡效果需要多少秒或毫秒。
  transition-timing-function 规定速度效果的速度曲线。
  transition-delay 定义过渡效果何时开始。

 

transform-origin :属性允许您改变被转换元素的位置

  2D 转换元素能够改变元素 x 和 y 轴。3D 转换元素还能改变其 Z 轴。

 

DOM

 

 

转载于:https://www.cnblogs.com/1138720556Gary/p/9395401.html

你可能感兴趣的文章
【原】Google浏览器刷新
查看>>
urllib2的GET和POST请求(五)
查看>>
树状数组入门及树状数组由来
查看>>
UUID介绍与生成的方法
查看>>
nginx高级玩法之根据来源ip分流
查看>>
16. 3Sum Closest
查看>>
BFS:Nightmare(可返回路径)
查看>>
vijos 1557:bzoj:1413: [ZJOI2009]取石子游戏
查看>>
hackerrank Alex对战Fedor
查看>>
list,string,tuple,dictionary之间的转换
查看>>
Action<T> 泛型委托 在跨线程访问控件委托中的应用
查看>>
主机屋----常用程序安装链接数据库教程
查看>>
JQuery传值给.ashx乱码
查看>>
java1.7之后的比较器特别之处
查看>>
Jmeter之分布式执行测试
查看>>
Python入门二
查看>>
去除首页内容栏的标题
查看>>
运筹与管理-基于价格随机化的非透明销售策略研究
查看>>
UVALive 5061 Lightning Energy Report --LCA
查看>>
模糊语意变数、规则和模糊运算--AForge.NET框架的使用(二)
查看>>