Welcom to 评论 - lizhenqiu blog!
#609
#610
<script> //数字滚动 (function($){ $.fn.numberRock=function(options){ var defaults={ lastNumber:100, duration:2000, easing:'swing' //swing(默认 : 缓冲 : 慢快慢) linear(匀速的) }; var opts=$.extend({}, defaults, options); $(this).animate({ num : "numberRock", // width : 300, // height : 300, },{ duration : opts.duration, easing : opts.easing, complete : function(){ console.log("success"); }, step : function(a,b){ //可以检测我们定时器的每一次变化 //console.log(a); //console.log(b.pos); //运动过程中的比例值(0~1) $(this).html(parseInt(b.pos * opts.lastNumber)); } }); } })(jQuery); $(function(){ $("#read-count").numberRock({ lastNumber:6666, duration:5000, easing:'swing', //慢快慢 }); }); </script>
#611
#612
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <meta name="apple-mobile-web-app-capable" content="yes" /> <title>jQuery手机自定义确认提示框代码</title> <style> *{ margin: 0; padding:0; list-style: none; font-size: 16px; color: rgba(0,0,0,.8); } a{ text-decoration: none; } /*jq-alert弹出层封装样式*/ .jq-alert{ position: fixed; top:0; left:0; width:100%; height:100%; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-justify-content: center; -webkit-align-items: center; justify-content: center; align-items: center; background-color: rgba(0,0,0,.3); z-index: 99; } .jq-alert .alert{ background-color: #FFF; width:80%; height:auto; border-radius: 4px; overflow: hidden; } .jq-alert .alert .title{ position: relative; margin: 0; font-size: .3rem; height: .8rem; line-height: .8rem; text-align: center; font-weight: normal; color: rgba(0,0,0,.8); } /*.jq-alert .alert .title:after{*/ /*position: absolute;*/ /*content: "";*/ /*bottom: 0;*/ /*left:0;*/ /*width: 100%;*/ /*height: 1px;*/ /*background-color: #ededed;*/ /*transform: scaley(.5);*/ /*-webkit-transform: scaley(.5);*/ /*}*/ .jq-alert .alert .content{ padding: .3rem; font-size: .28rem; color: rgba(0,0,0,.6); } .jq-alert .alert .content .prompt{ width:100%; } .jq-alert .alert .content .prompt .prompt-content{ font-size: .28rem; color: rgba(0,0,0,.54); } .jq-alert .alert .content .prompt .prompt-text{ background:none; border:none; outline: none; width: 100%; height: .6rem; box-sizing: border-box; margin-top: .2rem; background-color: #FFF; border:1px solid #dcdcdc; text-indent:5px; } .jq-alert .alert .content .prompt .prompt-text:focus{ border: 1px solid #2196F3; background-color: rgba(33,150,243,.08); } .jq-alert .alert .fd-btn{ position: relative; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-justify-content: center; -webkit-align-items: center; justify-content: center; align-items: center; } .jq-alert .alert .fd-btn:after{ position: absolute; content: ""; top:0; left:0; width:100%; height: 1px; background-color: #F3F3F3; } .jq-alert .alert .fd-btn a{ width:100%; height: .8rem; font-size: .26rem; display: flex; flex-direction: row; align-items: center; justify-content: center; color: rgba(0,0,0,.8); } .jq-alert .alert .fd-btn a.cancel{ position: relative; color: rgba(0,0,0,.5); } .jq-alert .alert .fd-btn a.cancel:after{ content: ""; position: absolute; top:.1rem; right:0; width: 1px; height: .6rem; background-color: #F3F3F3; } .jq-alert .alert .fd-btn a.confirm{ color: #2196F3; } .jq-alert .alert .fd-btn a.confirm:active{ background-color: #2196F3; color: #FFF; } /*toast弹出层*/ .jq-toast{ z-index: 999; position:fixed; top:0; left:0; width:100%; height: 100%; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; flex-direction: row; -webkit-flex-direction: row; -ms-flex-direction: row; justify-content: center; -webkit-justify-content: center; align-items: center; -webkit-align-items: center; } .jq-toast .toast{ max-width: 80%; padding: .1rem .2rem; background-color: rgba(0,0,0,.48); color: #FFF; border-radius: 4px; font-size: .28rem; } </style> <script type="text/javascript" src="https://lizhenqiu.com/templates/default/jquery.min.js"></script> <script> /*alert弹出层*/ function jqalert(param) { var title = param.title, content = param.content, yestext = param.yestext, notext = param.notext, yesfn = param.yesfn, nofn = param.nofn, nolink = param.nolink, yeslink = param.yeslink, prompt = param.prompt, click_bg = param.click_bg; if (click_bg === undefined){ click_bg = true; } if (yestext === undefined){ yestext = '确认'; } if (!nolink){ nolink = 'javascript:void(0);'; } if (!yeslink){ yeslink = 'javascript:void(0);'; } var htm = ''; htm +='<div class="jq-alert" id="jq-alert"><div class="alert">'; if(title) htm+='<h2 class="title">'+title+'</h2>'; if (prompt){ htm += '<div class="content"><div class="prompt">'; htm += '<p class="prompt-content">'+prompt+'</p>'; htm += '<input type="text" class="prompt-text"></div>'; htm +='</div>'; }else { htm+='<div class="content">'+content+'</div>'; } if (!notext){ htm+='<div class="fd-btn"><a href="'+yeslink+'" class="confirm" id="yes_btn">'+yestext+'</a></div>' htm+='</div>'; }else { htm+='<div class="fd-btn">'+ '<a href="'+nolink+'" data-role="cancel" class="cancel">'+notext+'</a>'+ '<a href="'+yeslink+'" class="confirm" id="yes_btn">'+yestext+'</a>'+ '</div>'; htm+='</div>'; } $('body').append(htm); var al = $('#jq-alert'); al.on('click','[data-role="cancel"]',function () { al.remove(); if (nofn){ param.nofn(); nofn = ''; } param = {}; }); $(document).delegate('.alert','click',function (event) { event.stopPropagation(); }); $(document).delegate('#yes_btn','click',function () { setTimeout(function () { al.remove(); },300); if (yesfn){ param.yesfn(); yesfn =''; } param = {}; }); if(click_bg === true){ $(document).delegate('#jq-alert','click',function () { setTimeout(function () { al.remove(); },300); yesfn =''; nofn = ''; param = {}; }); } } /*toast 弹出提示*/ function jqtoast(text,sec) { var _this = text; var this_sec = sec; var htm = ''; htm += '<div class="jq-toast" style="display: none;">'; if (_this){ htm +='<div class="toast">'+_this+'</div></div>'; $('body').append(htm); $('.jq-toast').fadeIn(); }else { jqalert({ title:'提示', content:'提示文字不能为空', yestext:'确定' }) } if (!sec){ this_sec = 2000; } setTimeout(function () { $('.jq-toast').fadeOut(function () { $(this).remove(); }); _this = ''; },this_sec); }</script> <script type="text/javascript"> setSize(); addEventListener('resize',setSize); function setSize() { document.documentElement.style.fontSize = document.documentElement.clientWidth/750*100+'px'; } </script> <style> .show-list{ width:80%; margin: 0 auto; } .show-list li{ height: 1rem; font-size: .3rem; display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 1px solid #dcdcdc; } </style> </head> <body> <ul class="show-list"> <li id="demo1">toast</li> <li id="demo2">alert</li> <li id="demo3">confirm</li> <li id="demo4">prompt</li> <li id="demo5">点击按钮跳转</li> <li id="demo6">取消默认点击背景消失</li> </ul> <script type="text/javascript"> $(function () { $('#demo1').click(function () { jqtoast('你点击了toast') }) $('#demo2').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等' }) }) $('#demo3').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等', yestext:'知道了', notext:'取消' }) }) $('#demo4').click(function () { jqalert({ title:'提示', prompt:'请问你叫什么名字?', yestext:'提交', notext:'取消', yesfn:function () { jqtoast('提交成功'); }, nofn:function () { jqtoast('你点击了取消'); } }) }) $('#demo5').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等', yeslink:'https://b.lizhenqiu.com/' }) }) $('#demo6').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等', click_bg:false }) }) }); </script> </body> </html>
#613
#614
#615
<!DOCTYPE html> <html> <head> <title>Title</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body> <div id="wp"></div> <script id="tpl" type="text/html"> <%=content%> <ul> <%for(var i = 0; i < list.length; i++) {%> <li><%:=list[i]%></li> <%}%> </ul> <p><%=ppp%></p> <p><%=tittlle%></p> </script> <script src="js/template.js"></script> <script> function successf(data){ //布局测试数据 /*var data={ list: ["yan","haijing"] ,content:'内虽然仍然' ,ppp:'我是换行' };*/ //var nnns=data; /*{ list: [{name: "yan"},{name: "haijing"}] ,content:'内虽然仍然' ,ppp:'我是换行' };*/ //alert(data); console.log(data); var tpl = document.getElementById('tpl').innerHTML; var html=template(tpl, data); document.getElementById('wp').innerHTML = html; } </script> <!--异步获取数据--> <script> ajax('get','t.php','1',successf); //获取服务器数据 function ajax(method, url, data, success) { var xhr = null; try { xhr = new XMLHttpRequest();//new一个xhr对象,这个对象像信使一样存在着 } catch (e) { xhr = new ActiveXObject('Microsoft.XMLHTTP');//为了兼容IE6 } //如果是get请求,而且data存在,则是要通过get请求发送数据,通过get请求发送数据,数据会被链接到请求地址之后 if (method == 'get' && data) { url += '?' + data; } //初始化请求,method表示请求方式,url是请求地址,true表示异步 xhr.open(method,url,true); if (method == 'get') { xhr.send();//发送请求 } else { xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');//post方式,需要设置请求头 xhr.send(data);//发送提交数据 } xhr.onreadystatechange = function() { if ( xhr.readyState == 4 ) {//4是请求最后的阶段, //http状态码,2开头便是还请求成功 if ( xhr.status == 200 ) { //json 格式化 var newdata=JSON.parse(xhr.responseText); success && success(newdata); //success && success(xhr.responseText);//在这里判断一下,如果success存在,则执行它,将响应数据作为参数传入回调函数 } else { alert('出错了,Err:' + xhr.status); } } } } </script> <!--异步结束--> </body> </html>
<?php $tt=array( 'list'=>array( '11111' ,'22222222' ) ,'content'=>'我是内容哦' ,'ppp'=>'21发达省份的31231212' ,'tittlle'=>'比爱透说是发射点发射点fda道非' ); //print_r($tt['list']); /*function my_json_decode($str){ // if (preg_match('/\"\w\":/', $str)) { // $str = preg_replace('/\"(\w+)\":/is', '$1:', $str); //给key加双引号 // } $str = preg_replace('/"(\w+)"(\s*:\s*)/is', '$1$2', $str); //去掉key的双引号 return $str; }*/ //echo my_json_decode(json_encode($tt)); echo (json_encode($tt)); //echo "{list: [{name: 'yan'},{name: 'haijing'}],content:'内虽然仍然',ppp:'我是换行'}"; ?>
</pre><pre code_snippet_id="421967" snippet_file_name="blog_20140708_2_9591675" name="code" class="php"><pre name="code" class="php"> function my_json_decode($str) { // if (preg_match('/\"\w\":/', $str)) { // $str = preg_replace('/\"(\w+)\":/is', '$1:', $str); //给key加双引号 // } $str = preg_replace('/"(\w+)"(\s*:\s*)/is', '$1$2', $str); //去掉key的双引号 return $str; } $str = '{"test":[{"testName":"哈哈","Url":"http://www.test.com"}]}'; $str = my_json_decode($str); echo "$str";
var newdata=JSON.parse(xhr.responseText); success && success(newdata);
#616
#617
#618
#619
#620
#621
#622
#623
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>
var dpr, rem, scale; var docEl = document.documentElement; var fontEl = document.createElement('style'); var metaEl = document.querySelector('meta[name="viewport"]'); dpr = window.devicePixelRatio || 1; rem = docEl.clientWidth * dpr / 10; scale = 1 / dpr; // 设置viewport,进行缩放,达到高清效果 metaEl.setAttribute('content', 'width=' + dpr * docEl.clientWidth + ',initial-scale=' + scale + ',maximum-scale=' + scale + ', minimum-scale=' + scale + ',user-scalable=no'); // 设置data-dpr属性,留作的css hack之用 docEl.setAttribute('data-dpr', dpr); // 动态写入样式 docEl.firstElementChild.appendChild(fontEl); fontEl.innerHTML = 'html{font-size:' + rem + 'px!important;}'; window.dpr = dpr; window.rem = rem;
.change_val(@name, @px){ @{name}: @px / 75 * 1rem; }
.container{ .change_val (width,123); //123是设计稿原值 .unchanged_val(font-size,100) }
.unchanged_val(@name, @px){ @{name}: round(@px / 2) * 1px; [data-dpr="2"] & { @{name}: @px * 1px; } // for mx3 [data-dpr="2.5"] & { @{name}: round(@px * 2.5 / 2) * 1px; } // for 小米note [data-dpr="2.75"] & { @{name}: round(@px * 2.75 / 2) * 1px; } [data-dpr="3"] & { @{name}: round(@px /*3 / 2) * 1px } [data-dpr="3.5"] & { @{name}: round(@px * 3.5 / 2) * 1px; } // for 三星note4 [data-dpr="4"] & { @{name}: @px * 2px; } }
html { font-size: calc(100vw/3.75); }
document.documentElement.style.fontSize = window.innerWidth/3.75 + 'px';
#624
<script>function js_getDPI() { var arrDPI = new Array; if (window.screen.deviceXDPI) { arrDPI[0] = window.screen.deviceXDPI; arrDPI[1] = window.screen.deviceYDPI; } else { var tmpNode = document.createElement("DIV"); tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden"; document.body.appendChild(tmpNode); arrDPI[0] = parseInt(tmpNode.offsetWidth); arrDPI[1] = parseInt(tmpNode.offsetHeight); tmpNode.parentNode.removeChild(tmpNode); } return arrDPI; } window.onload=function(){ alert("当前屏幕PPI "+js_getDPI()); }</script>
#625
.scale{ position: relative; } .scale:after{ content:""; position: absolute; bottom:0px; left:0px; right:0px; border-bottom:1px solid #ddd; -webkit-transform:scaleY(.5); -webkit-transform-origin:0 0; }
#626
#627
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAoklEQVQ4T+2T4Q2CMBCFv27CBjgCG+gIjAAbOAIjOIJs4Ai6gRvIBpjXXCOp19T/8pJLoTneXcj3Ah91wAV4bu68xwXoAZ2EzEAmE9AWTB6AelRDyaAx9zgh0wE4ATczcTdIE7wl0oe7wX/8RMHigfQTB3fDdM1IEvYyONdIVEOSqDwCY2Z2NaS/UNbqMSQmvauUPlfbNKpBSdTUVyXSs/XyBlRCNBG20I28AAAAAElFTkSuQmCC
确定要清除编辑框内容吗?
该删除操作将不可恢复。
删除 取消
激活Windows
转到"设置"以激活Windows。
#609
#610
<script> //数字滚动 (function($){ $.fn.numberRock=function(options){ var defaults={ lastNumber:100, duration:2000, easing:'swing' //swing(默认 : 缓冲 : 慢快慢) linear(匀速的) }; var opts=$.extend({}, defaults, options); $(this).animate({ num : "numberRock", // width : 300, // height : 300, },{ duration : opts.duration, easing : opts.easing, complete : function(){ console.log("success"); }, step : function(a,b){ //可以检测我们定时器的每一次变化 //console.log(a); //console.log(b.pos); //运动过程中的比例值(0~1) $(this).html(parseInt(b.pos * opts.lastNumber)); } }); } })(jQuery); $(function(){ $("#read-count").numberRock({ lastNumber:6666, duration:5000, easing:'swing', //慢快慢 }); }); </script>
#611
我会失去你两次,第一次在分手那天,第二次在你有了新欢之后。
#612
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <meta name="apple-mobile-web-app-capable" content="yes" /> <title>jQuery手机自定义确认提示框代码</title> <style> *{ margin: 0; padding:0; list-style: none; font-size: 16px; color: rgba(0,0,0,.8); } a{ text-decoration: none; } /*jq-alert弹出层封装样式*/ .jq-alert{ position: fixed; top:0; left:0; width:100%; height:100%; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-justify-content: center; -webkit-align-items: center; justify-content: center; align-items: center; background-color: rgba(0,0,0,.3); z-index: 99; } .jq-alert .alert{ background-color: #FFF; width:80%; height:auto; border-radius: 4px; overflow: hidden; } .jq-alert .alert .title{ position: relative; margin: 0; font-size: .3rem; height: .8rem; line-height: .8rem; text-align: center; font-weight: normal; color: rgba(0,0,0,.8); } /*.jq-alert .alert .title:after{*/ /*position: absolute;*/ /*content: "";*/ /*bottom: 0;*/ /*left:0;*/ /*width: 100%;*/ /*height: 1px;*/ /*background-color: #ededed;*/ /*transform: scaley(.5);*/ /*-webkit-transform: scaley(.5);*/ /*}*/ .jq-alert .alert .content{ padding: .3rem; font-size: .28rem; color: rgba(0,0,0,.6); } .jq-alert .alert .content .prompt{ width:100%; } .jq-alert .alert .content .prompt .prompt-content{ font-size: .28rem; color: rgba(0,0,0,.54); } .jq-alert .alert .content .prompt .prompt-text{ background:none; border:none; outline: none; width: 100%; height: .6rem; box-sizing: border-box; margin-top: .2rem; background-color: #FFF; border:1px solid #dcdcdc; text-indent:5px; } .jq-alert .alert .content .prompt .prompt-text:focus{ border: 1px solid #2196F3; background-color: rgba(33,150,243,.08); } .jq-alert .alert .fd-btn{ position: relative; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-justify-content: center; -webkit-align-items: center; justify-content: center; align-items: center; } .jq-alert .alert .fd-btn:after{ position: absolute; content: ""; top:0; left:0; width:100%; height: 1px; background-color: #F3F3F3; } .jq-alert .alert .fd-btn a{ width:100%; height: .8rem; font-size: .26rem; display: flex; flex-direction: row; align-items: center; justify-content: center; color: rgba(0,0,0,.8); } .jq-alert .alert .fd-btn a.cancel{ position: relative; color: rgba(0,0,0,.5); } .jq-alert .alert .fd-btn a.cancel:after{ content: ""; position: absolute; top:.1rem; right:0; width: 1px; height: .6rem; background-color: #F3F3F3; } .jq-alert .alert .fd-btn a.confirm{ color: #2196F3; } .jq-alert .alert .fd-btn a.confirm:active{ background-color: #2196F3; color: #FFF; } /*toast弹出层*/ .jq-toast{ z-index: 999; position:fixed; top:0; left:0; width:100%; height: 100%; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; flex-direction: row; -webkit-flex-direction: row; -ms-flex-direction: row; justify-content: center; -webkit-justify-content: center; align-items: center; -webkit-align-items: center; } .jq-toast .toast{ max-width: 80%; padding: .1rem .2rem; background-color: rgba(0,0,0,.48); color: #FFF; border-radius: 4px; font-size: .28rem; } </style> <script type="text/javascript" src="https://lizhenqiu.com/templates/default/jquery.min.js"></script> <script> /*alert弹出层*/ function jqalert(param) { var title = param.title, content = param.content, yestext = param.yestext, notext = param.notext, yesfn = param.yesfn, nofn = param.nofn, nolink = param.nolink, yeslink = param.yeslink, prompt = param.prompt, click_bg = param.click_bg; if (click_bg === undefined){ click_bg = true; } if (yestext === undefined){ yestext = '确认'; } if (!nolink){ nolink = 'javascript:void(0);'; } if (!yeslink){ yeslink = 'javascript:void(0);'; } var htm = ''; htm +='<div class="jq-alert" id="jq-alert"><div class="alert">'; if(title) htm+='<h2 class="title">'+title+'</h2>'; if (prompt){ htm += '<div class="content"><div class="prompt">'; htm += '<p class="prompt-content">'+prompt+'</p>'; htm += '<input type="text" class="prompt-text"></div>'; htm +='</div>'; }else { htm+='<div class="content">'+content+'</div>'; } if (!notext){ htm+='<div class="fd-btn"><a href="'+yeslink+'" class="confirm" id="yes_btn">'+yestext+'</a></div>' htm+='</div>'; }else { htm+='<div class="fd-btn">'+ '<a href="'+nolink+'" data-role="cancel" class="cancel">'+notext+'</a>'+ '<a href="'+yeslink+'" class="confirm" id="yes_btn">'+yestext+'</a>'+ '</div>'; htm+='</div>'; } $('body').append(htm); var al = $('#jq-alert'); al.on('click','[data-role="cancel"]',function () { al.remove(); if (nofn){ param.nofn(); nofn = ''; } param = {}; }); $(document).delegate('.alert','click',function (event) { event.stopPropagation(); }); $(document).delegate('#yes_btn','click',function () { setTimeout(function () { al.remove(); },300); if (yesfn){ param.yesfn(); yesfn =''; } param = {}; }); if(click_bg === true){ $(document).delegate('#jq-alert','click',function () { setTimeout(function () { al.remove(); },300); yesfn =''; nofn = ''; param = {}; }); } } /*toast 弹出提示*/ function jqtoast(text,sec) { var _this = text; var this_sec = sec; var htm = ''; htm += '<div class="jq-toast" style="display: none;">'; if (_this){ htm +='<div class="toast">'+_this+'</div></div>'; $('body').append(htm); $('.jq-toast').fadeIn(); }else { jqalert({ title:'提示', content:'提示文字不能为空', yestext:'确定' }) } if (!sec){ this_sec = 2000; } setTimeout(function () { $('.jq-toast').fadeOut(function () { $(this).remove(); }); _this = ''; },this_sec); }</script> <script type="text/javascript"> setSize(); addEventListener('resize',setSize); function setSize() { document.documentElement.style.fontSize = document.documentElement.clientWidth/750*100+'px'; } </script> <style> .show-list{ width:80%; margin: 0 auto; } .show-list li{ height: 1rem; font-size: .3rem; display: flex; flex-direction: row; justify-content: center; align-items: center; border-bottom: 1px solid #dcdcdc; } </style> </head> <body> <ul class="show-list"> <li id="demo1">toast</li> <li id="demo2">alert</li> <li id="demo3">confirm</li> <li id="demo4">prompt</li> <li id="demo5">点击按钮跳转</li> <li id="demo6">取消默认点击背景消失</li> </ul> <script type="text/javascript"> $(function () { $('#demo1').click(function () { jqtoast('你点击了toast') }) $('#demo2').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等' }) }) $('#demo3').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等', yestext:'知道了', notext:'取消' }) }) $('#demo4').click(function () { jqalert({ title:'提示', prompt:'请问你叫什么名字?', yestext:'提交', notext:'取消', yesfn:function () { jqtoast('提交成功'); }, nofn:function () { jqtoast('你点击了取消'); } }) }) $('#demo5').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等', yeslink:'https://b.lizhenqiu.com/' }) }) $('#demo6').click(function () { jqalert({ title:'提示', content:'自定义弹窗内容,居左对齐显示,告知需要确认的信息等', click_bg:false }) }) }); </script> </body> </html>
#613
#614
#615
<!DOCTYPE html> <html> <head> <title>Title</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body> <div id="wp"></div> <script id="tpl" type="text/html"> <%=content%> <ul> <%for(var i = 0; i < list.length; i++) {%> <li><%:=list[i]%></li> <%}%> </ul> <p><%=ppp%></p> <p><%=tittlle%></p> </script> <script src="js/template.js"></script> <script> function successf(data){ //布局测试数据 /*var data={ list: ["yan","haijing"] ,content:'内虽然仍然' ,ppp:'我是换行' };*/ //var nnns=data; /*{ list: [{name: "yan"},{name: "haijing"}] ,content:'内虽然仍然' ,ppp:'我是换行' };*/ //alert(data); console.log(data); var tpl = document.getElementById('tpl').innerHTML; var html=template(tpl, data); document.getElementById('wp').innerHTML = html; } </script> <!--异步获取数据--> <script> ajax('get','t.php','1',successf); //获取服务器数据 function ajax(method, url, data, success) { var xhr = null; try { xhr = new XMLHttpRequest();//new一个xhr对象,这个对象像信使一样存在着 } catch (e) { xhr = new ActiveXObject('Microsoft.XMLHTTP');//为了兼容IE6 } //如果是get请求,而且data存在,则是要通过get请求发送数据,通过get请求发送数据,数据会被链接到请求地址之后 if (method == 'get' && data) { url += '?' + data; } //初始化请求,method表示请求方式,url是请求地址,true表示异步 xhr.open(method,url,true); if (method == 'get') { xhr.send();//发送请求 } else { xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');//post方式,需要设置请求头 xhr.send(data);//发送提交数据 } xhr.onreadystatechange = function() { if ( xhr.readyState == 4 ) {//4是请求最后的阶段, //http状态码,2开头便是还请求成功 if ( xhr.status == 200 ) { //json 格式化 var newdata=JSON.parse(xhr.responseText); success && success(newdata); //success && success(xhr.responseText);//在这里判断一下,如果success存在,则执行它,将响应数据作为参数传入回调函数 } else { alert('出错了,Err:' + xhr.status); } } } } </script> <!--异步结束--> </body> </html>
<?php $tt=array( 'list'=>array( '11111' ,'22222222' ) ,'content'=>'我是内容哦' ,'ppp'=>'21发达省份的31231212' ,'tittlle'=>'比爱透说是发射点发射点fda道非' ); //print_r($tt['list']); /*function my_json_decode($str){ // if (preg_match('/\"\w\":/', $str)) { // $str = preg_replace('/\"(\w+)\":/is', '$1:', $str); //给key加双引号 // } $str = preg_replace('/"(\w+)"(\s*:\s*)/is', '$1$2', $str); //去掉key的双引号 return $str; }*/ //echo my_json_decode(json_encode($tt)); echo (json_encode($tt)); //echo "{list: [{name: 'yan'},{name: 'haijing'}],content:'内虽然仍然',ppp:'我是换行'}"; ?>
PHP去掉json字符串key的双引号
</pre><pre code_snippet_id="421967" snippet_file_name="blog_20140708_2_9591675" name="code" class="php"><pre name="code" class="php"> function my_json_decode($str) { // if (preg_match('/\"\w\":/', $str)) { // $str = preg_replace('/\"(\w+)\":/is', '$1:', $str); //给key加双引号 // } $str = preg_replace('/"(\w+)"(\s*:\s*)/is', '$1$2', $str); //去掉key的双引号 return $str; } $str = '{"test":[{"testName":"哈哈","Url":"http://www.test.com"}]}'; $str = my_json_decode($str); echo "$str";
var newdata=JSON.parse(xhr.responseText); success && success(newdata);
#616
阳春白雪
阳阿薤露
下里巴人
一个人功成名就之后最想做的
就是把曾对自己知根知底的人灭了
终究没有谁是白纸
总有些或卑微或无耻或虚伪或丑陋的故事
任何污点的曝光都会让我们身败名裂
我开始理解萨特那句 [他人即地狱]
开始担心是谁手握达摩克利斯之剑
开始害怕人潮中无意交错的目光
被人认出我的模样
揭穿我的过往
使我千年道行一朝丧
我终于变的胆怯又卑微
皆因为
爱你是我的软肋
#617
#618
www.tdg58.com
www.gzxydl.com
www.seabcd.com
www.55bt.eu
www.11sasa.com
www.4444kk.com
www.53aiai.com
www.kkk755.com
www.678kjwww.99pupu.com
www.97yes.com
www.q1se.com
www.ggjj.com
www.111kfc.com
www.9999pp.com
www.youjizz.com
www.45xtv.com
www.vvv15.com
www.444kk.com
www.62hh.com
www.108hh.com
www.xsw333.com
www.maose222.com
www.99pupu.com
www.97yes.com
www.q1se.com
www.ggjj.com
www.taosege.com
www.111kfc.com
www.9999pp.com
www.youjizz.com
www.45xtv.com
www.vvv15.com
www.444kk.com
www.62hh.com
www.108hh.com
www.xsw333.com
www.maose222.com
www.66yeye.com
www.gzxydl.com
www.seabcd.com
www.55bt.eu
www.11sasa.com
www.4444kk.com
www.53aiai.com
www.kkk755.com
www.678kjwww.99pupu.com
www.97yes.com
www.q1se.com
www.ggjj.com
www.taosege.net
www.111kfc.com
www.9999pp.com
www.youjizz.com
www.45xtv.com
www.vvv15.com
www.444kk.com
www.62hh.com
www.108hh.com
www.xsw333.com
www.maose222.cowww.99pupu.com
www.97yes.com
www.q1se.com
www.ggjj.com
www.taosege.net
www.111kfc.com
www.9999pp.com
www.youjizz.com
www.45xtv.com
www.vvv15.com
www.444kk.com
www.62hh.com
www.108hh.com
www.xsw333.com
www.maose222.com
www.66yeye.com
www.gzxydl.com
www.seabcd.com
www.55bt.eu
www.11sasa.com
www.4444kk.com
www.53aiai.com
www.kkk755.com
www.678kjwww.99pupu.com
www.97yes.com
www.q1se.com
www.ggjj.com
www.taosege.net
www.111kfc.com
www.9999pp.com
www.youjizz.com
www.45xtv.com
www.vvv15.com
www.444kk.com
www.62hh.com
www.108hh.com
www.xsw333.com
www.maose222.com
www.66yeye.com
www.gzxydl.com
www.seabcd.com
www.55bt.eu
www.11sasa.com
www.4444kk.com
www.53aiai.com
www.kkk755.com
www.678kj.com
www.r7r8.com
www.66dxw.com
www.sao117.com
www.aaa77.com
www.r7r8.com
www.66dxw.com
www.sao117.com
www.aaa776.com
www.66yeye.com
www.gzxydl.com
www.seabcd.com
www.55bt.eu
www.11sasa.com
www.4444kk.com
www.53aiai.com
www.kkk755.com
www.678kj.com
www.r7r8.com
www.66dxw.com
www.sao117.com
www.aaa77.com
www.r7r8.com
www.66dxw.com
www.sao117.com
www.aaa776.com
我只能帮你们帮到这里了。
但记得,叫小姐出来玩的时候,对她们好点,出来玩,总是要还的。
黄美嘉:广东 15202029914
舒琳:广西、18697979390
美玲:广东、18376690119
何媛:湖南、18707455763
露露:广西、15277166525
王欢:陕西、15177117025
文文:东北、18276405678
珊珊:广西、18277222776
小欣:东北、15136915698
赵颖:广西、18776939798
佟艳:东北、13457673131
李洁:东北、15850471789
小白:重庆、15077014818
青青:贵州、15677180006
阿丽:湖南、15778022726
微微:广西、15978156323
杨洋:贵州、18778971228
佳佳:东北、18577037718
小丽:河南、18523227577
张雪:贵州、13507887268
玲玲:山东、15863156777
小芬:贵州、13647706242
杨静:东北、18777183848
钟欣:广西、18776001910
赵俐红:东北、13503656036
小瑶:湖南、15277187588
佳楠:东北、13768334777
小丽:广西、13877959701
阿丽:云南、18076344703
小丽:湖南、18674537156
马玲:东北、118724237755
小丽:湖南、18674537286
小娜:广西、15277713656
小玉:广西、18775916617
晓晓:广西、13607880639
小四川:四川、18776951787
少钧:广西、15578140626
小老实:广西、18777116996
拉拉:广西、15777145552
陈瑶:广西、13877102002
金丽:东北、15909453666
段洋:东北、18278109121
陈瑞:贵州、1351662576
小青:广西、13560941534
清清:广西、18677796313
小羽:广西、15777146138
小雪:广西、13100515622
思琦:广西、15077122283
小娜:东北、13803659942
欧静:东北、13277888099
曾娜:广西、18680273340
沈霞:湖南、13925087370
小琴:广西、15977722825
婷婷:陕西、18792919899
露露:江苏、15996183688
柳柳:广西、18260877913
刘宇:广东、15820245283
小妹:湖南、18007712220
芳芳:河南、18939590765
小卿: 东莞、1345008294
#619
1984年1月,香港九龙电子表厂工人张明敏匆忙赴京。
接机的人死活找不到他。大陆这边以为他年过四旬,可他那年只有26岁。
他紧张地把自己关在酒店两天,不敢出门。门外的北京是完全陌生的世界。
入夜,他问前台小姑娘有没有可口可乐。
四个字小姑娘都会写,但连在一起不知道什么意思。
电视机前的胡耀邦感动得通宵未眠,带领全家人连夜学歌,天一亮就让秘书询问录播带。
那晚张明敏一口气唱了4首歌,有3首都是观众点的。
那个年代的春晚观众点什么,演员就唱什么。整个会场最核心区域是点播台。
那里也是最危险区域,因为担心电话太多线路过热,黄一鹤安排工作人员准备灭火器,严阵以待。
黄一鹤是春晚奠基人,整个八十年代一口气执导了五届春晚,统治着那些年除夕夜的笑声与掌声。
彼时的春晚。尚未上升到家国天下的高度,不过是忙碌了一年,大家轻轻松松玩一个晚上。
一台春晚,李谷一能返场九次,姜昆即当主持还能穿插说三段相声。
那个年代,笑点都低,但笑声真诚,所有的欢喜都如火焰般炙热。
1987年春晚,费翔登台,唱了两首情绪完全不同的歌。《故乡的云》悠远伤怀,《冬天里的一把火》放肆狂热。
一个高大、英俊、有着蓝色瞳孔的美男子,足以颠覆一个时代的灰暗审美。
那一年,他出品专辑《跨越四海的歌》,里面的歌都没名气,但全国音像店却排起长龙,好长时间内,店前只有两块牌子:“费翔有货”、“费翔无货”。
执导完1990年春晚后,黄一鹤谢幕,春晚导演换成了郎昆和大胡子赵安。
其实前一年,他就收到了春晚邀约,并去哈尔滨分会场录好了节目带。
除夕夜,他通知了开原所有亲朋,但直到片尾字幕播出,也没见到他的节目。有朋友笑他是大忽悠,一不小心就触碰了未来。
那个年代,赵本山还只是赵老蔫,还不是大忽悠。
真正的大忽悠在台下,名叫张宝胜。
这位号称能“耳朵识字”和“空瓶取药”的江湖奇人,相关传说覆盖整个八十年代,进入九十年代仍余威不减。
从1990年到1998年,张宝胜受邀在台下连坐八年,据说这样大师才能“给面子,不发功弄碎晚会的灯泡”。
1998年泰坦尼克和互联网一起走红中国,信息化浪潮汹涌。一年后的春晚上,赵丽蓉用拼音唱了那首《我心依旧》。
下台后,巩汉林躲进洗手间哭了。六天前,他们得知了老太太已是肺癌晚期。
1999年,是一条伤感的分割线,上个世纪所有的悲欢,都要在这里有个了断。
那年春天,陈佩斯和朱时茂状告央视下属公司侵权。最终,法院判决央视登报道歉,并赔偿二人经济损失333293元。
赔偿金拿到手遥遥无期,比这更漫长的,是封杀的时限。
那年五一,陈佩斯开着破旧的桑塔纳,被媳妇骗到北京延庆。媳妇告诉他:开荒种树,从头再来。
山岭上泥土湿润,风轻且自在。
喜剧之王拱手作揖,四野再无喧闹的掌声。
二
1998年,赵本山、高秀敏、范伟的组合完成首秀,演了小品《拜年》。
棉裤臃肿的赵本山,对着乡长三胖子矜持地说:正是陛下。
铁三角仅试运行了一年就暂时停摆。
1999年,赵本山拿到个本子《昨天今天明天》,他邀请宋丹丹搭档。黄宏很不高兴,叮嘱宋丹丹,“那本子听说很烂”。
没有人能拦住白云黑土。在实话实说的温情鼓点中,两位东北老人向二十世纪挥手作别。
结尾时略藏私心:我十分想见赵忠祥;倪萍就是我梦中情人,爱咋咋地!
2004年,倪萍再也当不了黑土的梦中情人了。
45岁的她胖到连礼服都穿不下,同台主持的周涛、董卿、曹颖风华正茂,倪萍感到自己已经可有可无。她提前看到了未来,“可以自己走,绝不让人扶。”
10年后,她再次回到央视,主持了一档名为《等着我》的节目。尽管已经衰老发福,一双大眼睛也不复当年清亮,但节目全国收视率仅次于《奔跑吧兄弟》。
据说节目主要收视群体,集中于“二三线城市和农村”的“一边看电视一边抹眼泪的大妈们”。那是倪萍的绝对领域。
2004年,同倪萍一起离开的,还有白云十分想见的赵忠祥。
赵忠祥温和的声音,贯穿了15届春晚,从未出错。然而2004年,在春晚舞台之外,外出觅食的北极熊掉入冰窟。
那年卓伟还小,不然天知道都能爆出什么。
2007年,当了3年副县长后,牛群从蒙城县灰头土脸地归来了。他追在冯巩后面,一路请客买单,但终究旧梦难圆。
众人之中,唯赵本山还念九十年代旧情,伸手拉了一把,将牛群拉成了牛策划,策划公鸡中的战斗机,欧耶。
小品火了,但牛群仍在失落的暗影内。
赵本山自己的日子其实也不好过。两年前,高秀敏意外离世,范伟远走高飞,何庆魁伤心过度,透支了一生的才情和悲伤。
连宋丹丹也拒绝再上春晚后,东北王真的成了寡人。
2009年,赵本山在上海脑溢血住院,死里逃生后,他突然明白,相识满天下,到头来靠得住的还是自家人。
师傅垂青谁,就是改谁的命。
只可惜,带上台这些徒弟,脑袋一个比一个大,脖子一个比一个粗,但却如木偶般,无命可改。
三
新世纪第二个十年,春晚的魔力似乎在渐渐消散。
2011年,一个名叫任月丽的女孩成为最后一批魔力受益者,她更广为人知的名字叫西单女孩。
春晚没有给西单女孩插上《天使的翅膀》,她和别人成立了家牙膏公司,她主要工作是在各种商演中宣传自家牙膏。
和任月丽一起登上那年春晚的,还有王旭和刘刚。不过人们记住的只有旭日阳刚,哪怕两人早已不再合唱。
曾经光着膀子高唱《春天里》的打工两兄弟,年轻的刘刚已泯然众人,有限的新闻说他膨胀了,开豪车,小区鸣笛,暴打老太。
年长的王旭,则忙于赶场各家公司年会。依旧还是那首《春天里》。
2011年,赵本山带着徒弟们表演小品《同桌的你》。节目中有个梗:以下省略多少多少字。
小品王始料未及的是,他和他的徒弟们,将被省略多少多少年。
赵本山离开时,最欣喜的应该是黄宏,陪榜二十年的他,终于看到了拿个一等奖的可能。
赵本山离开后的第一年,黄宏演出小品《荆轲刺秦》。
这是个注定失败的故事。
那一年,连续举办了20年的“我最喜爱的春晚节目”评选正式取消,黄宏却登上了不少“最不想看到的春晚面孔”榜单。
2013年,黄宏从春晚下岗,专职八一电影制片厂厂长,身体力行自己的台词:我不下岗谁下岗?
没有了陈小二,没有了赵老蔫,没有了牛群冯巩,没有了倪萍赵忠祥,时间洪流太急,我们被冲得太远,回望已一片模糊。
去年,姜昆和戴志诚说了一段相声,名叫《新虎口遐想》。
假装掉到老虎洞里的他,再也没有得到热心群众的帮助,他们都在忙着拍照,发微博,发朋友圈。
相声不好笑。姜昆们费力地想赶上这个时代,却不知道人们只是想念记忆中的他们。
两个多月前,一个深夜,赵本山悄悄发了一条微博:大家有想念我的小品么?
第二天上午,微博删掉了。
独自莫凭栏,无限江山,别时容易见时难。换了人间。
#620
也许某些学校是有的…
#621
#622
#623
关于rem
这种技术需要一个参考点,一般都是以<body>的“font-size”为基准。
比如我们设置body,html的字体大小为10px;那么1rem就是10px,
这样一来,我们设置字体大小相当于“14px”时,只需要将其值设置为“1.4em”。
1.手机淘宝一直用的方法:思路是通过js动态的获取 设备的DPR(设备像素比),根据dpr来改变标签
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>
中的属性值;
var dpr, rem, scale; var docEl = document.documentElement; var fontEl = document.createElement('style'); var metaEl = document.querySelector('meta[name="viewport"]'); dpr = window.devicePixelRatio || 1; rem = docEl.clientWidth * dpr / 10; scale = 1 / dpr; // 设置viewport,进行缩放,达到高清效果 metaEl.setAttribute('content', 'width=' + dpr * docEl.clientWidth + ',initial-scale=' + scale + ',maximum-scale=' + scale + ', minimum-scale=' + scale + ',user-scalable=no'); // 设置data-dpr属性,留作的css hack之用 docEl.setAttribute('data-dpr', dpr); // 动态写入样式 docEl.firstElementChild.appendChild(fontEl); fontEl.innerHTML = 'html{font-size:' + rem + 'px!important;}'; window.dpr = dpr; window.rem = rem;
此时 在dpr=2时1rem=75px;
所以如果我们要设置div的宽度为750px;(注:750px,为设计稿中div的宽度)就要写为:width:750/75*1rem;
最后因为dpr为2,页面scale了0.5,所以在手机屏幕上显示的真实宽高应该是375px,就刚刚好。
如果设置的值不是好算的数字,比如123px,那就很蛋疼了
为了减少计算,在less中可以定义以下函数
.change_val(@name, @px){ @{name}: @px / 75 * 1rem; }
这样在less中就可以写为
.container{ .change_val (width,123); //123是设计稿原值 .unchanged_val(font-size,100) }
另:在设计中我们一般希望font-size一直固定不变对此:
.unchanged_val(@name, @px){ @{name}: round(@px / 2) * 1px; [data-dpr="2"] & { @{name}: @px * 1px; } // for mx3 [data-dpr="2.5"] & { @{name}: round(@px * 2.5 / 2) * 1px; } // for 小米note [data-dpr="2.75"] & { @{name}: round(@px * 2.75 / 2) * 1px; } [data-dpr="3"] & { @{name}: round(@px /*3 / 2) * 1px } [data-dpr="3.5"] & { @{name}: round(@px * 3.5 / 2) * 1px; } // for 三星note4 [data-dpr="4"] & { @{name}: @px * 2px; } }
2.我们可以以iphone6(375*667)设计稿为原型:
设置css
html { font-size: calc(100vw/3.75); }
这个意思就是设置 html的font-size为100px;
因为这样写比较方便,比如在写一个div宽度为75px时,直接定义width:0.75rem;就可以了
为了避免calc()的兼容性问题,可以加上如下js;
document.documentElement.style.fontSize = window.innerWidth/3.75 + 'px';
#624
获取PPI:
<script>function js_getDPI() { var arrDPI = new Array; if (window.screen.deviceXDPI) { arrDPI[0] = window.screen.deviceXDPI; arrDPI[1] = window.screen.deviceYDPI; } else { var tmpNode = document.createElement("DIV"); tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden"; document.body.appendChild(tmpNode); arrDPI[0] = parseInt(tmpNode.offsetWidth); arrDPI[1] = parseInt(tmpNode.offsetHeight); tmpNode.parentNode.removeChild(tmpNode); } return arrDPI; } window.onload=function(){ alert("当前屏幕PPI "+js_getDPI()); }</script>
#625
由于最小的物理像素差异,一条直线的显示,iphone5它能显示的最小宽度其实是理论上说的0.5px。
不是所有手机浏览器都能识别border: 0.5px;,ios7以下,android等其他系统里,0.5px会被当成为0px处理
通常是给元素order-bottom: 1px solid #ddd;,然后通过transform: scaleY(.5)缩小0.5倍来达到0.5px的效果,
.scale{ position: relative; } .scale:after{ content:""; position: absolute; bottom:0px; left:0px; right:0px; border-bottom:1px solid #ddd; -webkit-transform:scaleY(.5); -webkit-transform-origin:0 0; }
通常我们在写移动端时,是按照设计稿标注的像素除以设备的DPR来写真实的像素,
比如在iPhone6上,我们写的20px字体世界上在视觉效应上有20px;
所以当我们写1px边框时,在手机上看起来会变粗变为2px;
#626
#627
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAoklEQVQ4T+2T4Q2CMBCFv27CBjgCG+gIjAAbOAIjOIJs4Ai6gRvIBpjXXCOp19T/8pJLoTneXcj3Ah91wAV4bu68xwXoAZ2EzEAmE9AWTB6AelRDyaAx9zgh0wE4ATczcTdIE7wl0oe7wX/8RMHigfQTB3fDdM1IEvYyONdIVEOSqDwCY2Z2NaS/UNbqMSQmvauUPlfbNKpBSdTUVyXSs/XyBlRCNBG20I28AAAAAElFTkSuQmCC