生成一维条码和遮蔽层
2016-07-13 10:24
281 查看
注意barcode是生成一个一维条码。重点是
<div id="divmask" style="z-index:9;background-color:rgb(128, 128, 128);opacity:0.8;position:absolute;"></div>
<pre name="code" class="html"> <div style="z-index:10;background-color:white;position:absolute;top:50%;left:50%;margin:-35px 0 0 -132px;width:264px; height:85px;display:none;"> <div id="bar" style="position:relative;top:10px;" onclick="BarHide(this)"></div> </div>
$(document).ready(function(){ if ($('.discount').length == 0) { $('body div').eq(1).attr('style', 'height:60px;text-align:center;position:relative;top:15px;font-size:20px;'); $('body div').eq(1).html('暂无优惠券'); } document.addEventListener('touchmove', function (event) { //判断条件,条件成立才阻止背景页面滚动,其他情况不会再影响到页面滚动 if (!$('#bar').parent().is(":hidden")) { event.preventDefault(); } }) })
function generateBar(e) { var data=$(e).attr('title'); $('#bar').barcode(data, 'code128', { barWidth: 1, barHeight: 60,output:'bmp' }); $('#bar').show(); $('#divmask').css('width', window.innerWidth); $('#divmask').css('height', window.innerHeight); $('#bar').parent().width($('#bar').width()+1); $('#bar').parent().show(); } function BarHide(e) { $('#bar').parent().hide(); $('#divmask').css('width', 0); $('#divmask').css('height', 0); }
相关文章推荐
- Chapter 17 Replication 复制
- String参数是传值还是传递引用的测试
- Python多进程并发(multiprocessing)
- PostgreSQL问题解决--- integer out of range
- Spring技术内幕(一):IOC容器
- 端口占用查杀
- hdu 1018
- 共享锁和排它锁
- spark新能优化之序列化
- 用tornado实现一个简单的websocket样例
- MVC 之 EF框架简介
- 面试经验
- 网络知识
- 在 Linux 下使用任务管理器
- Static关键字所有用法详解
- SSH问题总结(1)_Spring注入问题
- 2014 鞍山区域赛 C HDU5072 Coprime 莫比乌斯/容斥+同色三角形
- 【Unity3D自学记录】鼠标拖拽物体移动
- 如何设置感兴趣的区域ROI
- 脱壳基础