您的位置:首页 > 其它

生成一维条码和遮蔽层

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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: