1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- window.onresize = function(){
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- }
- function parseQueryString(url) {
- // var urlObj = {};
- // var reg = /([^?=&]+)=([^?=&]+)/g;
- // url.replace(reg, ($0, $1, $2) => {
- // urlObj[$1] = decodeURIComponent($2);
- // })
- // return urlObj;
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if(pair[0] == variable){return pair[1];}
- }
- return(false);
- }
- /**
- * [showMsg 提示各种错误信息,3s后消失]
- <div class="alert-info" style="display: none;">
- <p></p>
- </div>
- */
- function showMsg(msg) {
- var msgBox = $('.alert-info');
- msgBox.children('p').text(msg);
- msgBox.show();
- setTimeout(function() {
- msgBox.hide();
- }, 3000);
- }
- function lastHref() {
- // var pathName = window.location.pathname.substring(1);
- // var DirName = pathName == '' ? '' : pathName.substring(0, pathName.lastIndexOf('/'));
- // var reg=new RegExp("%20","g");
- // return window.location.origin+"/"+DirName.replace(reg, " ");//替换空格
- var test=window.location.pathname;
- var newTest=test.split("/")
- var test1=newTest[newTest.length-1];
- return window.location.host+test.replace("/"+test1,"")
- }
|