mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
add mobile check
This commit is contained in:
+9
-3
@@ -18,6 +18,7 @@
|
||||
var fontSize = options && options.fontSize || '15px';
|
||||
var backgroundColor = options && options.backgroundColor || '#fff';
|
||||
var TABLE_ID = options && options.table_id || 'table_0909099';
|
||||
var mobile = typeof orientation !== 'undefined';
|
||||
|
||||
this.el.id = DIV_ID;
|
||||
this.el.style.position = 'absolute';
|
||||
@@ -33,7 +34,9 @@
|
||||
var cssStr = '<style type="text/css">';
|
||||
cssStr += '#' + TABLE_ID + '{text-align:center;width:100%;height:160px;border-top:1px solid #CECDCE;background-color:#FFF;}';
|
||||
cssStr += '#' + TABLE_ID + ' td{width:33%;border:1px solid #ddd;border-right:0;border-top:0;}';
|
||||
// cssStr += '#' + TABLE_ID + ' td:hover{background-color:#1FB9FF;color:#FFF;}';
|
||||
if(!mobile){
|
||||
cssStr += '#' + TABLE_ID + ' td:hover{background-color:#1FB9FF;color:#FFF;}';
|
||||
}
|
||||
cssStr += '</style>';
|
||||
|
||||
//Button
|
||||
@@ -70,8 +73,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
//this.el.onclick = addEvent;
|
||||
this.el.ontouchstart = addEvent;
|
||||
if(mobile){
|
||||
this.el.ontouchstart = addEvent;
|
||||
}else{
|
||||
this.el.onclick = addEvent;
|
||||
}
|
||||
body.appendChild(this.el);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user