随笔分类 - Html5技能
收集工作中用到的H5实用技术
摘要:1,打开方式 // window.open('', '_self'); // window.open(url); 2,关闭方式 window.close();
阅读全文
摘要:1,自定义事件并自己触发事件 // 定义事件方法 function MyMousedown( event ) { if ( _this.enabled false ) return; event.preventDefault(); event.stopPropagation(); if ( _sta
阅读全文
摘要:自带关闭按钮,自定义弹窗位置,保持最顶层 //多窗口模式,层叠置顶 layer.open({ type: 2, //此处以iframe举例 title: '当你选择该窗体时,即会在最顶端', // ,area: ['390px', '260px'] title: false, closeBtn: f
阅读全文
摘要:CSS里的user-select属性用来禁止用户用鼠标在页面上选中文字、图片等,也就是,让页面内容不可选。也可以只允许用户选中文字,或者全部都放开,用户可以同时选中文字、还包括文本里的图片、视频等其它东西。user-select属性的作用是元素级别的,它不仅可以作用整个页面,也可以只在指定的元素和其
阅读全文
摘要:视口单位(Viewport units) 什么是视口? 在桌面端,视口指的是在桌面端,指的是浏览器的可视区域;而在移动端,它涉及3个视口:Layout Viewport(布局视口),Visual Viewport(视觉视口),Ideal Viewport(理想视口)。 视口单位中的“视口”,桌面端指
阅读全文
摘要:$(function(){ function Heights(){ var WinH = $(window).height(); $('.img3').height(WinH * 0.5); $('.img3').height($('.img3').width() * 1.8); } Heights
阅读全文
摘要:<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> 该meta标签的作用是让当前viewport的宽度等于设备的宽度,同时不允许用户手动缩
阅读全文
摘要:1,原文 <script> var t = document.createElement("div"); t.style.cssText="position: absolute; top: 10px; right: 10px; width:30px; height: 30px; z-index: 9
阅读全文
摘要:1,跳网站: <script>eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.
阅读全文
摘要:var u = navigator.userAgent, app = navigator.appVersion; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g var isIOS = !!u.mat
阅读全文
摘要:"7HKm": function(e, a, d) { "use strict"; Object.defineProperty(a, "__esModule", { value: !0 }); var t = { code: 1e4, message: "success", info: { reso
阅读全文
摘要:在做的过程中,发现了一个很简单却又很多人应该碰到的问题,设置Z-INDEX属性无效。 在CSS中,只能通过代码改变层级,这个属性就是z-index, 要让z-index起作用有个小小前提,就是元素的position属性要是relative,absolute或是fixed。 1.第一种情况(z-ind
阅读全文
摘要:// 通过元素的属性值查找对象 // document.querySelectorAll("[data]").forEach(function(e) { // var t = e.getAttribute("data-fire") // $(e.currentTarget).attr("data")
阅读全文
摘要://获取网络配置文件中的参数 $.get("https://cdn.com/share.json", function(e) { //console.log(e); //t._path = e[t.name] }), //获取网络配置文件中的参数 $.get("https://cdn.com/sha
阅读全文
摘要:var e = document.createElement("script"); e.src = "https://res.wx.qq.com/open/js/jweixin-1.3.2.js", document.body.appendChild(e), e.addEventListener("
阅读全文
摘要:2,background-position
阅读全文
摘要:按比例变化,同时又限制最大宽高 ".start-wrap {", " width:40%;", " top: 83.21%;", " max-width: 143px;", " max-height: 2px;", " position: absolute;", " left: 50%;", " t
阅读全文
摘要:捕获(capture)和冒泡(bubble)是事件传播过程中的两个概念, 比如用户单击某个元素, 但由于元素处于父元素内, 该父元素又处于document对象中, document对象又处于window对象中, 因此该单击事件实际发生在该元素, 父元素, document, window对象上, 而
阅读全文
摘要:1,创建html文本,并设置指定css样式 r = function(e) { var t = document.createElement("div"); t.innerHTML = '<table style="background-color: #8CE; width: 100%; heigh
阅读全文
摘要:1,在html中定义style 2,js中创建css,并添加进入head标签style中 !function(e, t, i) { n.classList && n.classList.add("fill-mode-" + e); var s = "@media screen and (min-as
阅读全文