1、禁止微信长按保存
代码如下(示例):
img {
pointer-events: none;
}
2.iframe嵌套使微信内置地图调用失败
代码如下(示例):
parent.wx.openLocation({//一层嵌套添加一层parent
latitude: parseFloat(lists_latitude),
longitude: parseFloat(lists_longitude),
name: lists_name,
address: "请点击右侧按钮开始导航",
scale: 14,
infoUrl: '',
success:function(res){
console.log(res)
},
fail:function(err){
console.log(err)
}
});
2.5.跳转微信地图
代码如下(示例):
var list_addr='请点击右侧按钮开始导航'
var lists_latitude=''
var lists_longitude=''
var lists_name=''
window.location.href = 'https://apis.map.qq.com/uri/v1/marker?marker=coord:' + lists_latitude + ',' + lists_longitude + ';title:' + lists_name + ';addr:' + list_addr + '';
3.图片放大(调用pinchzoom.js)
pinchzoom.js(提取码pich)
代码如下(示例):
<div class="pinch-zoom">
<img src="" style="width:100%;height: auto;">
</div>
$('div.pinch-zoom').each(function () {
new RTP.PinchZoom($(this), {});
});
4.数组操作
代码如下(示例):
arrayObj. push([item1 [item2 [. . . [itemN ]]]]);// 将一个或多个新元素添加到数组结尾,并返回数组新长度。
arrayObj.unshift([item1 [item2 [. . . [itemN ]]]]);// 将一个或多个新元素添加到数组开始,数组中的元素自动后移,返回数组新长度。
arrayObj.splice(insertPos,0,[item1[, item2[, . . . [,itemN]]]]);//将一个或多个新元素插入到数组的指定位置,插入位置的元素自动后移,返回""。
4.css操作
文本单行溢出
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
文本多行溢出
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
5.map标签
<body onload="resizeCamera();" onresize="resizeCamera();">
<div>
<img usemap='#Map' id="thisimage" style="width:100%;height: auto;" onclick=''>
</div>
<map name='Map' id='map'>
<area shape="circle" id="point1" alt="18" para='2160,5103' coords="121,286,6">//coords(x,y,r)
</map>
<script type="text/javascript">
//先在ps上获得图片上点位置的(x,y)放入para,再通过图片宽度与屏幕宽度比动态改变x,y。赋值至coords
//(计算有可能出错,暂时未发现)
var img_width=$("#thisimage").width();
var img_height=$("#thisimage").height();
var r=img_width/6676
$("#map area").each(function(index){
var paras=$(this).attr("para").split(",");
// console.log(paras)
var w = parseInt(paras[0] * r);
var h = parseInt(paras[1] * r);
// var r1 = parseInt(para[2] * sf);
$(this).attr("coords", w + ',' + h + ',' + '6');
});
function resizeCamera() {
var picw = $("#thisimage").width();
var pich = $("#thisimage").height();
// console.log(img_width,picw)
var sf=picw/img_width
console.log(sf)
var r2 = parseInt(picw * 0.018207283);
$("#map area").each(function(index){
var para=$(this).attr("coords").split(",");
// console.log(para)
var w1 = parseInt(para[0] * sf);
var h1 = parseInt(para[1] * sf);
var r1 = parseInt(para[2] * sf);
$(this).attr("coords", w1 + ',' + h1 + ',' + r1);
});
// this.funcReadImgInfo()
}
</script>
</body>
4.跳出iframe
top.location.href='http://www.baidu.com'
5.清除微信浏览器缓存(安卓手机)
发送debugx5.qq.com至聊天页面,点击打开
6.vue设置浏览器图标
1.index.html
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
2.webpack.prod.conf.js(添加代码 favicon: path.resolve('favicon.ico'))
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: config.build.index,
template: 'index.html',
inject: true,
favicon: path.resolve('favicon.ico'), // 引入图片地址
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
3.webpack.dev.conf.js(添加代码 favicon: path.resolve('favicon.ico'))
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true,
favicon: path.resolve('favicon.ico'), // 引入图片地址
}),
7.uni-app时间戳转换
filters: {
// 时间
formatDate: function(value) {
var date = new Date();
//date.setTime(value);
var month = date.getMonth() + 1;
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var minutes = date.getMinutes();
if (minutes < 10)
minutes = "0" + minutes;
var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
" " + hours + ":" + minutes;
return time;
}
}
8 .遮罩层下文字图片模糊处理(高斯模糊)不是全屏模糊
遮罩层上添加:backdrop-filter:blur(5px)
总结
最近写jq的东西比较多,防止忘记,有错误及时更正