vue 移入显示_jQuery/Vue的鼠标移入移出效果

这篇文章主要介绍了关于jQuery/Vue的鼠标移入移出效果 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下实现思路1、根据鼠标的位置定位在元素内出现的方向2、根据方向动态设置遮罩层样式3、设置动画移动遮罩层jQuery版jQuery插件可以通过$.fn.extend方法进行拓展。htmlmouse hovermouse hovermouse hovermouse hovermou...
摘要由CSDN通过智能技术生成

这篇文章主要介绍了关于jQuery/Vue的鼠标移入移出效果 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

实现思路

1、根据鼠标的位置定位在元素内出现的方向

2、根据方向动态设置遮罩层样式

3、设置动画移动遮罩层

jQuery版

jQuery插件可以通过$.fn.extend方法进行拓展。

html

mouse hover

mouse hover

mouse hover

mouse hover

mouse hover

mouse hover

css.container {

width: 600px;

margin: auto;

margin-top: 100px;

}

.content {

float: left;

position: relative;

height: 150px;

width: 150px;

margin: 20px;

overflow: hidden;

background: #ccc;

}

.content .shade {

position: absolute;

top: 0;

display: none;

width: 100%;

height: 100%;

line-height: 100px;

color: #fff;

background: rgba(0, 0, 0, 0.7);

}

js

(function ($) {

$.fn.extend({

"mouseMove": function (child) {

$(this).hover(function (e) {

$this = $(this);

var ele = $this.find(child);

var clientX = e.clientX;

var clientY = e.clientY;

var top = parseInt($this.offset().top);

var bottom = parseInt(top + $this.height());

var left = parseInt($this.offset().left);

<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值