鼠标悬停出现二维码动画放大,url转二维码

鼠标悬停出现二维码动画放大,url转二维码

效果

在这里插入图片描述

首先引入jq和qrcode.js
<script type='text/javascript' src='http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js'></script> 
<script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script> 
css
.qrcode-wrap {
    position: fixed;
    top: 20px;
    left: 50%;
    background-color: #fff;
    text-align: center;
    padding: 15px 18px;
    border-radius: 4px;
    cursor: pointer;
    transform-origin: top left;
    transition: transform .3s;
    transform: translateX(380px) scale(.2);
}
.qrcode-wrap .qrcode {
    width: 128px;
    height: 128px;
}
.qrcode-wrap:hover {
	transform:translateX(380px) scale(1)
}
.qrcode-wrap .title {
	font-size:14px;
	text-align:center;
	margin-bottom:10px;
}
.qrcode-wrap .tip {
	font-size:12px;
	color:#999daf;
	margin-top:10px;
}
html
<div class="qrcode-wrap">
	<div class="title">扫码预览</div>
	<div class="qrcode" id="qrcode"></div>
    <div class="tip">扫描二维码 分享给好友</div>
</div>
script
jQuery('#qrcode').qrcode({ width: 128, height: 128, text: window.location.href });
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值