原创 通用樣式表

@charset "utf-8"; html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,p,form,fieldset,legend,input,button,textarea,p,bloc

原创 MetaHandler.js:移動端適配各種屏幕

JS: !function () { var opt = function() { var ua = navigator.userAgent, android = ua.match(/(Android);?[\s\

原创 多行文本未知高度垂直居中-

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>多行文本未知高度垂直居中-by一絲</title> </head> <body> <body> <d

原创 CSS3 滑動開關

[class^="u-icon"] { display: inline-block; color: #fff; vertical-align: mid

原创 JSON轉爲字符串,字符串轉爲JSON格式

比如我有兩個變量,我要將a轉換成字符串,將b轉換成JSON對象: var a={"name":"tom","sex":"男","age":"24"}; var b='{"name":"Mike","sex":"女","

原创 代碼片段 URL

function directRightUrl () { let paths = window.location.href.split('#') paths[1] = paths[1] || '/' // 老式的#!分隔跳轉

原创 移動前端自適應解決方案(rem font-size)

<script> var deviceWidth = document.documentElement.clientWidth; if(deviceWidth > 640) { de

原创 頁面跳轉,返回

(function(win){ var TabBarPlug=function(options){ this.barTitle='DEMOBAR'; } TabBarPlug.prototype={ //獲取瀏覽過的地址

原创 歡迎使用CSDN-markdown編輯器

//用戶名正則,4到16位(字母,數字,下劃線,減號) var uPattern = /^[a-zA-Z0-9_-]{4,16}$/; //輸出 true console.log(uPattern.test("iFat3")); //密碼

原创 數組排序

<script type="text/javascript"> //交換方法 function swap(items, firstIndex, secondIndex){ var temp = items[firstInde

原创 身份證驗證

/* * 功能:驗證身份證是否可用,如果可用,則提取生日、性別等信息 * 參數:傳入一個字符串(建議不要採用數字,18位的數字會有精確度問題) * 返回:包含基本信息的對象 * 作者:HTML5學堂 http://www.h5course

原创 AJAX 封裝

$(function(){ /** * ajax封裝 * url 發送請求的地址 * data 發送到服務器的數據,數組存儲,如:{"date": new Date().getTime(), "state": 1}

原创 sea css

html, body { height: 100%; display: flex; align-items: center; justify-content: center; background:

原创 button css

html, body, .checkbox, .checkbox .inner, .checkbox .inner .toggle { height: 100%; display: flex; align-item

原创 JS 操作瀏覽器的參數

function getQueStr(url, ref) //取獲參數值 { var str = url.substr(url.indexOf('?') + 1); if (str.indexOf('&') != -1)