1034 lines
52 KiB
HTML
1034 lines
52 KiB
HTML
<!DOCTYPE html>
|
||
<html style="display: none;" lang="zh">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<!--
|
||
© Material Theme
|
||
https://github.com/viosey/hexo-theme-material
|
||
Version: 1.4.0 -->
|
||
<script>window.materialVersion = "1.4.0"</script>
|
||
|
||
<!-- Title -->
|
||
|
||
<title>
|
||
|
||
解析卡片式轮播图 |
|
||
|
||
Jzxer's Blog
|
||
</title>
|
||
|
||
<!-- dns prefetch -->
|
||
<meta http-equiv="x-dns-prefetch-control" content="on">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- Meta & Info -->
|
||
<meta http-equiv="X-UA-Compatible">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||
<meta name="theme-color" content="#6C6CE5">
|
||
<meta name="author" content="Jzxer">
|
||
<meta name="description" itemprop="description" content="web全栈工程师,音乐,电吉他,摇滚,html,css,javascript">
|
||
<meta name="keywords" content="js,前端,javascript,html,vue,轮播图">
|
||
|
||
<!-- Site Verification -->
|
||
|
||
|
||
|
||
<!-- Favicons -->
|
||
<link rel="icon shortcut" type="image/ico" href="/img/favicon.ico">
|
||
<link rel="icon" sizes="192x192" href="/img/favicon.png">
|
||
<link rel="apple-touch-icon" href="/img/favicon.png">
|
||
|
||
<!--iOS -->
|
||
<meta name="apple-mobile-web-app-title" content="Title">
|
||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||
<meta name="HandheldFriendly" content="True">
|
||
<meta name="MobileOptimized" content="480">
|
||
|
||
<!-- Add to homescreen for Chrome on Android -->
|
||
<meta name="mobile-web-app-capable" content="yes">
|
||
|
||
<!-- Add to homescreen for Safari on iOS -->
|
||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||
<meta name="apple-mobile-web-app-title" content="Jzxer's Blog">
|
||
|
||
<!-- The Open Graph protocol -->
|
||
<meta property="og:url" content="">
|
||
<meta property="og:type" content="blog">
|
||
<meta property="og:title" content="解析卡片式轮播图 | Jzxer's Blog">
|
||
<meta property="og:image" content="/img/favicon.png" />
|
||
<meta property="og:description" content="web全栈工程师,音乐,电吉他,摇滚,html,css,javascript">
|
||
<meta property="og:article:tag" content="轮播图">
|
||
|
||
|
||
<meta property="article:published_time" content="Sat Jun 24 2017 23:18:35 GMT+0800" />
|
||
<meta property="article:modified_time" content="Mon Jan 22 2018 14:43:23 GMT+0800" />
|
||
|
||
|
||
<!-- The Twitter Card protocol -->
|
||
<meta name="twitter:title" content="解析卡片式轮播图 | Jzxer's Blog">
|
||
<meta name="twitter:description" content="web全栈工程师,音乐,电吉他,摇滚,html,css,javascript">
|
||
<meta name="twitter:image" content="/img/favicon.png">
|
||
<meta name="twitter:card" content="summary_large_image" />
|
||
<meta name="twitter:url" content="" />
|
||
|
||
<!-- Add canonical link for SEO -->
|
||
|
||
<link rel="canonical" href="/论轮播图的原理.html" />
|
||
|
||
|
||
<!-- Structured-data for SEO -->
|
||
|
||
|
||
|
||
|
||
<script type="application/ld+json">
|
||
{
|
||
"@context": "https://schema.org",
|
||
"@type": "Article",
|
||
"publisher": {
|
||
"@type": "Organization",
|
||
"name": "Jzxer's Blog",
|
||
"logo": "/img/favicon.png"
|
||
},
|
||
"author": {
|
||
"@type": "Person",
|
||
"name": "Jzxer",
|
||
"image": {
|
||
"@type": "ImageObject",
|
||
"url": "/img/favicon.png"
|
||
},
|
||
"description": "对的,坚持!错的,放弃!"
|
||
},
|
||
"headline": "解析卡片式轮播图",
|
||
"url": "/论轮播图的原理.html",
|
||
"datePublished": "Sat Jun 24 2017 23:18:35 GMT+0800",
|
||
"dateModified": "Mon Jan 22 2018 14:43:23 GMT+0800",
|
||
"description": "web全栈工程师,音乐,电吉他,摇滚,html,css,javascript",
|
||
"mainEntityOfPage": {
|
||
"@type": "WebPage",
|
||
"@id": ""
|
||
}
|
||
}
|
||
</script>
|
||
|
||
|
||
|
||
|
||
<!--[if lte IE 9]>
|
||
<link rel="stylesheet" href="/css/ie-blocker.css">
|
||
|
||
|
||
<script src="/js/ie-blocker.zhCN.js"></script>
|
||
|
||
<![endif]-->
|
||
|
||
<!-- Import lsloader -->
|
||
<script>(function(){window.lsloader={jsRunSequence:[],jsnamemap:{},cssnamemap:{}};lsloader.removeLS=function(key){try{localStorage.removeItem(key)}catch(e){}};lsloader.setLS=function(key,val){try{localStorage.setItem(key,val)}catch(e){}};lsloader.getLS=function(key){var val="";try{val=localStorage.getItem(key)}catch(e){val=""}return val};versionString="/*"+materialVersion+"*/";lsloader.clean=function(){try{var keys=[];for(var i=0;i<localStorage.length;i++){keys.push(localStorage.key(i))}keys.forEach(function(key){var data=lsloader.getLS(key);if(data&&data.indexOf(versionString)===-1){lsloader.removeLS(key)}})}catch(e){}};lsloader.clean();lsloader.load=function(jsname,jspath,cssonload){cssonload=cssonload||function(){};var code;code=this.getLS(jsname);if(code&&code.indexOf(versionString)===-1){this.removeLS(jsname);this.requestResource(jsname,jspath,cssonload);return}if(code){var versionNumber=code.split(versionString)[0];if(versionNumber!=jspath){console.log("reload:"+jspath);this.removeLS(jsname);this.requestResource(jsname,jspath,cssonload);return}code=code.split(versionString)[1];if(/\.js?.+$/.test(versionNumber)){this.jsRunSequence.push({name:jsname,code:code});this.runjs(jspath,jsname,code)}else{document.getElementById(jsname).appendChild(document.createTextNode(code));cssonload()}}else{this.requestResource(jsname,jspath,cssonload)}};lsloader.requestResource=function(name,path,cssonload){var that=this;if(/\.js?.+$/.test(path)){this.iojs(path,name,function(path,name,code){that.setLS(name,path+versionString+code);that.runjs(path,name,code)})}else if(/\.css?.+$/.test(path)){this.iocss(path,name,function(code){document.getElementById(name).appendChild(document.createTextNode(code));that.setLS(name,path+versionString+code)},cssonload)}};lsloader.iojs=function(path,jsname,callback){var that=this;that.jsRunSequence.push({name:jsname,code:""});try{var xhr=new XMLHttpRequest;xhr.open("get",path,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status>=200&&xhr.status<300||xhr.status==304){if(xhr.response!=""){callback(path,jsname,xhr.response);return}}that.jsfallback(path,jsname)}};xhr.send(null)}catch(e){that.jsfallback(path,jsname)}};lsloader.iocss=function(path,jsname,callback,cssonload){var that=this;try{var xhr=new XMLHttpRequest;xhr.open("get",path,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status>=200&&xhr.status<300||xhr.status==304){if(xhr.response!=""){callback(xhr.response);cssonload();return}}that.cssfallback(path,jsname,cssonload)}};xhr.send(null)}catch(e){that.cssfallback(path,jsname,cssonload)}};lsloader.iofonts=function(path,jsname,callback,cssonload){var that=this;try{var xhr=new XMLHttpRequest;xhr.open("get",path,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status>=200&&xhr.status<300||xhr.status==304){if(xhr.response!=""){callback(xhr.response);cssonload();return}}that.cssfallback(path,jsname,cssonload)}};xhr.send(null)}catch(e){that.cssfallback(path,jsname,cssonload)}};lsloader.runjs=function(path,name,code){if(!!name&&!!code){for(var k in this.jsRunSequence){if(this.jsRunSequence[k].name==name){this.jsRunSequence[k].code=code}}}if(!!this.jsRunSequence[0]&&!!this.jsRunSequence[0].code&&this.jsRunSequence[0].status!="failed"){var script=document.createElement("script");script.appendChild(document.createTextNode(this.jsRunSequence[0].code));script.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(script);this.jsRunSequence.shift();if(this.jsRunSequence.length>0){this.runjs()}}else if(!!this.jsRunSequence[0]&&this.jsRunSequence[0].status=="failed"){var that=this;var script=document.createElement("script");script.src=this.jsRunSequence[0].path;script.type="text/javascript";this.jsRunSequence[0].status="loading";script.onload=function(){that.jsRunSequence.shift();if(that.jsRunSequence.length>0){that.runjs()}};document.body.appendChild(script)}};lsloader.tagLoad=function(path,name){this.jsRunSequence.push({name:name,code:"",path:path,status:"failed"});this.runjs()};lsloader.jsfallback=function(path,name){if(!!this.jsnamemap[name]){return}else{this.jsnamemap[name]=name}for(var k in this.jsRunSequence){if(this.jsRunSequence[k].name==name){this.jsRunSequence[k].code="";this.jsRunSequence[k].status="failed";this.jsRunSequence[k].path=path}}this.runjs()};lsloader.cssfallback=function(path,name,cssonload){if(!!this.cssnamemap[name]){return}else{this.cssnamemap[name]=1}var link=document.createElement("link");link.type="text/css";link.href=path;link.rel="stylesheet";link.onload=link.onerror=cssonload;var root=document.getElementsByTagName("script")[0];root.parentNode.insertBefore(link,root)};lsloader.runInlineScript=function(scriptId,codeId){var code=document.getElementById(codeId).innerText;this.jsRunSequence.push({name:scriptId,code:code});this.runjs()};lsloader.loadCombo=function(jslist){var updateList="";var requestingModules={};for(var k in jslist){var LS=this.getLS(jslist[k].name);if(!!LS){var version=LS.split(versionString)[0];var code=LS.split(versionString)[1]}else{var version=""}if(version==jslist[k].path){this.jsRunSequence.push({name:jslist[k].name,code:code,path:jslist[k].path})}else{this.jsRunSequence.push({name:jslist[k].name,code:null,path:jslist[k].path,status:"comboloading"});requestingModules[jslist[k].name]=true;updateList+=(updateList==""?"":";")+jslist[k].path}}var that=this;if(!!updateList){var xhr=new XMLHttpRequest;xhr.open("get",combo+updateList,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status>=200&&xhr.status<300||xhr.status==304){if(xhr.response!=""){that.runCombo(xhr.response,requestingModules);return}}else{for(var i in that.jsRunSequence){if(requestingModules[that.jsRunSequence[i].name]){that.jsRunSequence[i].status="failed"}}that.runjs()}}};xhr.send(null)}this.runjs()};lsloader.runCombo=function(comboCode,requestingModules){comboCode=comboCode.split("/*combojs*/");comboCode.shift();for(var k in this.jsRunSequence){if(!!requestingModules[this.jsRunSequence[k].name]&&!!comboCode[0]){this.jsRunSequence[k].status="comboJS";this.jsRunSequence[k].code=comboCode[0];this.setLS(this.jsRunSequence[k].name,this.jsRunSequence[k].path+versionString+comboCode[0]);comboCode.shift()}}this.runjs()}})();</script>
|
||
|
||
<!-- Import CSS & jQuery -->
|
||
|
||
<style id="css/material.min.css"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("css/material.min.css","/css/material.min.css?fJTiM/K1J3dWIruo3pxtAw==",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";})</script>
|
||
<style id="css/style.min.css"></style><script>if(typeof window.lsLoadCSSMaxNums === "undefined")window.lsLoadCSSMaxNums = 0;window.lsLoadCSSMaxNums++;lsloader.load("css/style.min.css","/css/style.min.css?oCSEO3ST+aEypEwttTDI9g==",function(){if(typeof window.lsLoadCSSNums === "undefined")window.lsLoadCSSNums = 0;window.lsLoadCSSNums++;if(window.lsLoadCSSNums == window.lsLoadCSSMaxNums)document.documentElement.style.display="";})</script>
|
||
|
||
|
||
<style>
|
||
|
||
|
||
|
||
|
||
.footer-sns-weibo {
|
||
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik0xMzUuMiA3OWMtOC42IDMtMjIuOCAxMi40LTMyLjggMjEuOC04LjIgNy44LTIyLjIgMzEtMjQuNiA0MC42LTEgNC4yLTEuNiAxNjctMS42IDM2NC42IDAgMjg0LjguNCAzNTguNCAyLjYgMzY0IDEuNCAzLjggNi44IDEzIDEyIDIwLjQgOC44IDEyLjggMjQgMjUuNCA0MS44IDM1IDYgMy40IDI3IDMuNiAzNjcuNCAzLjYgMjg2LjIgMCAzNjIuNi0uNiAzNjktMi42IDE5LjgtNi4yIDUxLjItMzcuNiA1Ny40LTU3LjQgMi02LjQgMi42LTgyLjYgMi42LTM2OFYxNDFsLTQuMi05Yy0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E1LjYgMTIuNC0xNyAxMy0yOS44IDE0LTcuNi44LTIyLjQgMi4yLTMzIDMuNi0yMi42IDIuNi00NS42IDEtNTMuOC0zLjgtMy4yLTItOC02LjgtMTAuOC0xMC44LTIuNi00LjItOC40LTEwLjQtMTIuOC0xMy44LTguMi02LjgtMTMuNC0xNi40LTE5LjQtMzctMy44LTEzLjItMi44LTIxLjggNS4yLTQ3LjYgMy4yLTEwLjQgNi0xNC42IDE3LjQtMjUuOCAxMi40LTEyLjIgMjMuOC0yMi4yIDMzLjItMjkuNiA0LTMgMzguNi05LjQgNTMuNC05LjggNSAwIDE4LjIgMS42IDI5LjQgMy42eiIvPjxwYXRoIGQ9Ik0zODcuMiA2MDZjLTEyLjIgMy44LTE4LjIgMTMuNC0xNSAyNC42IDUuOCAyMS4yIDI3LjggMjUuOCA0MC42IDguNiA2LjYtOC44IDcuOC0xNi4yIDQuMi0yNC00LjgtMTAuMi0xNS40LTEzLjQtMjkuOC05LjJ6Ii8+PC9zdmc+);
|
||
}
|
||
|
||
|
||
|
||
|
||
.footer-sns-github {
|
||
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgY2xhc3M9Imljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik0xMzguNCA3OGMtNi40IDEuNC0yNi40IDE0LjItMzYgMjIuOC04IDcuMi0yMiAyOS44LTI0LjQgMzkuMi0xLjYgNi40LTIgMTEzLjItMS42IDM2OCAuNiAyOTkuNCAxIDM1OS44IDMuNCAzNjQgMTEgMjAuMiAyMS42IDMyLjQgMzcuMiA0MyAxNS42IDEwLjYgMTcuMiAxMS4yIDM0LjIgMTMuMiAxMC42IDEuMiA2My40IDEuNiAxMjcuNiAxLjRsMTA5LjYtLjYgNi02LjggNi4yLTYuOC0xLjItMjUuMmMtLjgtMTUuOC0uMi0zMy40I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40LTMwLjggMjUuMi05LjQgNjQuNC0xMS40IDEwMS4yLTUuMnptLTM3NC40IDRjMTIgNC42IDExLjQtNi40IDExLjQgMjAxIC4yIDE4MC44IDAgMTg5LjYtMy42IDE5My40LTIgMi4yLTUuOCA0LjgtOC40IDUuOC0yLjYgMS4yLTI2LjIgMi01Mi42IDItNTEuOCAwLTU2LjYtMS02MS40LTExLjYtMS42LTMuNC0yLjItNjEuNC0yLjItMTkwLjggMC0xNzAuNC4yLTE4Ni42IDMuNC0xOTEuOCAxLjgtMy4yIDUuMi02LjYgNy40LTcuOCA1LjQtMi42IDk5LjItMi44IDEwNi0uMnoiLz48L3N2Zz4=);
|
||
}
|
||
|
||
|
||
|
||
|
||
</style>
|
||
|
||
|
||
<!-- Config CSS -->
|
||
|
||
<!-- Other Styles -->
|
||
<style>
|
||
body, html {
|
||
font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
||
}
|
||
|
||
a {
|
||
color: #0098A6;
|
||
}
|
||
|
||
.mdl-card__media,
|
||
#search-label,
|
||
#search-form-label:after,
|
||
#scheme-Paradox .hot_tags-count,
|
||
#scheme-Paradox .sidebar_archives-count,
|
||
#scheme-Paradox .sidebar-colored .sidebar-header,
|
||
#scheme-Paradox .sidebar-colored .sidebar-badge{
|
||
background-color: #272822 !important;
|
||
}
|
||
|
||
/* Sidebar User Drop Down Menu Text Color */
|
||
#scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:hover,
|
||
#scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:focus {
|
||
color: #272822 !important;
|
||
}
|
||
|
||
#post_entry-right-info,
|
||
.sidebar-colored .sidebar-nav li:hover > a,
|
||
.sidebar-colored .sidebar-nav li:hover > a i,
|
||
.sidebar-colored .sidebar-nav li > a:hover,
|
||
.sidebar-colored .sidebar-nav li > a:hover i,
|
||
.sidebar-colored .sidebar-nav li > a:focus i,
|
||
.sidebar-colored .sidebar-nav > .open > a,
|
||
.sidebar-colored .sidebar-nav > .open > a:hover,
|
||
.sidebar-colored .sidebar-nav > .open > a:focus,
|
||
#ds-reset #ds-ctx .ds-ctx-entry .ds-ctx-head a {
|
||
color: #272822 !important;
|
||
}
|
||
|
||
.toTop {
|
||
background: #272822 !important;
|
||
}
|
||
|
||
.material-layout .material-post>.material-nav,
|
||
.material-layout .material-index>.material-nav,
|
||
.material-nav a {
|
||
color: #272822;
|
||
}
|
||
|
||
#scheme-Paradox .MD-burger-layer {
|
||
background-color: #272822;
|
||
}
|
||
|
||
#scheme-Paradox #post-toc-trigger-btn {
|
||
color: #272822;
|
||
}
|
||
|
||
.post-toc a:hover {
|
||
color: #0098A6;
|
||
text-decoration: underline;
|
||
}
|
||
|
||
</style>
|
||
|
||
|
||
<!-- Theme Background Related-->
|
||
|
||
<style>
|
||
body{
|
||
background-image: url(/img/bg.jpg);
|
||
}
|
||
</style>
|
||
|
||
|
||
|
||
|
||
<!-- Fade Effect -->
|
||
|
||
<style>
|
||
.fade {
|
||
transition: all 800ms linear;
|
||
-webkit-transform: translate3d(0,0,0);
|
||
-moz-transform: translate3d(0,0,0);
|
||
-ms-transform: translate3d(0,0,0);
|
||
-o-transform: translate3d(0,0,0);
|
||
transform: translate3d(0,0,0);
|
||
opacity: 1;
|
||
}
|
||
|
||
.fade.out{
|
||
opacity: 0;
|
||
}
|
||
</style>
|
||
|
||
|
||
<!-- Import Font -->
|
||
|
||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
|
||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet">
|
||
|
||
|
||
<script>lsloader.load("js/jquery.min.js","/js/jquery.min.js?ezyEvm8ST5CGfpA+kFFi1g==")</script>
|
||
|
||
|
||
<script>function Queue(){this.dataStore=[];this.offer=b;this.poll=d;this.execNext=a;this.debug=false;this.startDebug=c;function b(e){if(this.debug){console.log("Offered a Queued Function.")}if(typeof e==="function"){this.dataStore.push(e)}else{console.log("You must offer a function.")}}function d(){if(this.debug){console.log("Polled a Queued Function.")}return this.dataStore.shift()}function a(){var e=this.poll();if(e!==undefined){if(this.debug){console.log("Run a Queued Function.")}e()}}function c(){this.debug=true}}var queue=new Queue();</script>
|
||
|
||
<!-- Analytics -->
|
||
|
||
|
||
<!-- Custom Head -->
|
||
|
||
</head>
|
||
|
||
|
||
|
||
<body id="scheme-Paradox" class="lazy">
|
||
<div class="material-layout mdl-js-layout has-drawer is-upgraded">
|
||
|
||
|
||
<!-- Main Container -->
|
||
<main class="material-layout__content" id="main">
|
||
|
||
<!-- Top Anchor -->
|
||
<div id="top"></div>
|
||
|
||
|
||
<!-- Hamburger Button -->
|
||
<button class="MD-burger-icon sidebar-toggle">
|
||
<span class="MD-burger-layer"></span>
|
||
</button>
|
||
|
||
|
||
<!-- Post TOC -->
|
||
|
||
|
||
<!-- Back Button -->
|
||
<!--
|
||
<div class="material-back" id="backhome-div" tabindex="0">
|
||
<a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon"
|
||
href="#" onclick="window.history.back();return false;"
|
||
target="_self"
|
||
role="button"
|
||
data-upgraded=",MaterialButton,MaterialRipple">
|
||
<i class="material-icons" role="presentation">arrow_back</i>
|
||
<span class="mdl-button__ripple-container">
|
||
<span class="mdl-ripple"></span>
|
||
</span>
|
||
</a>
|
||
</div>
|
||
-->
|
||
|
||
<!-- Left aligned menu below button -->
|
||
<button id="post-toc-trigger-btn"
|
||
class="mdl-button mdl-js-button mdl-button--icon">
|
||
<i class="material-icons">format_list_numbered</i>
|
||
</button>
|
||
|
||
|
||
<ul class="post-toc-wrap mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="post-toc-trigger-btn" style="max-height:80vh; overflow-y:scroll;">
|
||
<ol class="post-toc"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#原理"><span class="post-toc-number">1.</span> <span class="post-toc-text">原理</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#无限滚动"><span class="post-toc-number">2.</span> <span class="post-toc-text">无限滚动</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#小按钮切换"><span class="post-toc-number">3.</span> <span class="post-toc-text">小按钮切换</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#延迟动画函数"><span class="post-toc-number">4.</span> <span class="post-toc-text">延迟动画函数</span></a></li></ol>
|
||
<!--
|
||
<li class="mdl-menu__item">
|
||
Some Action
|
||
</li>
|
||
-->
|
||
</ul>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- Layouts -->
|
||
|
||
<!-- Post Module -->
|
||
<div class="material-post_container">
|
||
|
||
<div class="material-post mdl-grid">
|
||
<div class="mdl-card mdl-shadow--4dp mdl-cell mdl-cell--12-col">
|
||
|
||
<!-- Post Header(Thumbnail & Title) -->
|
||
|
||
<!-- Paradox Post Header -->
|
||
|
||
|
||
<!-- Random Thumbnail -->
|
||
<div class="post_thumbnail-random mdl-card__media mdl-color-text--grey-50">
|
||
<script type="text/ls-javascript" id="post-thumbnail-script">
|
||
var randomNum = Math.floor(Math.random() * 19 + 1);
|
||
|
||
$('.post_thumbnail-random').attr('data-original', '/img/random/material-' + randomNum + '.png');
|
||
$('.post_thumbnail-random').addClass('lazy');
|
||
</script>
|
||
|
||
|
||
|
||
<p class="article-headline-p">
|
||
解析卡片式轮播图
|
||
</p>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- Paradox Post Info -->
|
||
<div class="mdl-color-text--grey-700 mdl-card__supporting-text meta">
|
||
|
||
<!-- Author Avatar -->
|
||
<div id="author-avatar">
|
||
<img src="/img/avatar.png" width="44px" height="44px" alt="Author Avatar"/>
|
||
</div>
|
||
<!-- Author Name & Date -->
|
||
<div>
|
||
<strong>Jzxer</strong>
|
||
<span>6月 24, 2017</span>
|
||
</div>
|
||
|
||
<div class="section-spacer"></div>
|
||
|
||
<!-- Favorite -->
|
||
<!--
|
||
<button id="article-functions-like-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon btn-like">
|
||
<i class="material-icons" role="presentation">favorite</i>
|
||
<span class="visuallyhidden">favorites</span>
|
||
</button>
|
||
-->
|
||
|
||
<!-- Qrcode -->
|
||
|
||
<button id="article-functions-qrcode-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
|
||
<i class="material-icons" role="presentation">devices other</i>
|
||
<span class="visuallyhidden">devices other</span>
|
||
</button>
|
||
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-qrcode-button">
|
||
<li class="mdl-menu__item">在其它设备中阅读本文章</li>
|
||
|
||
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMYAAADGCAAAAACs8KCBAAAB5ElEQVR42u3aO3LDMAwFQN//0kmbJswDIMUWuaw8E324Kl4Igq+vLcYLAwMDAwMDA+NjGK94JHf9/Gv1+vIcMDAwDmP8EW3LKeZPW3+UfA4YGBgnM64K0OSuC+aAgYGBETCiWPzl+RgYGBj3MZJJrKN5fRcGBgbGvIhNStNk4fjmWhwDA+OBjHxT/r7f/9rfwMDAeBRjdNwh3m7LWwtvODOCgYHx8YxqOE6o+fXR1h4GBsZhjMmmW++wV748LRexGBgYBzASZO9DXBvrGBgYpzHy10xitxeyzaP2GBgY2zHyx+Vl5ySmR0UsBgbGdowk2pKtsZxdbVsWWpgYGBibMnql5qQQzQ+Q/fEhMDAwDmMkD622JCf45B8ABgbGOYzqplg1ZKsxWrgGAwPjMMZVTc3J9lnebMDAwDiNMTk8UW1nzpuaGBgYZzLmS8Be+7N6wGLU38DAwHg4o/rKdUxPIvWCMyMYGBibMqojeU21DL6lFsfAwNiIMQnB+SHX6gIUAwPjZEavoVidei9wMTAwMHoNgHnUVtsAzVocAwPjSEavlO01FTAwMDCuCtz1grL3mUZFLAYGxtaMa4vYZCHYuxIDA+NMRl5Y9rb+1+x1KN/SwsTAwHgU47kDAwMDAwMDA+Ot4xvlgJxx+8L4+wAAAABJRU5ErkJggg==">
|
||
|
||
</ul>
|
||
|
||
|
||
<!-- Tags (bookmark) -->
|
||
|
||
<button id="article-functions-viewtags-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
|
||
<i class="material-icons" role="presentation">bookmark</i>
|
||
<span class="visuallyhidden">bookmark</span>
|
||
</button>
|
||
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-viewtags-button">
|
||
<li class="mdl-menu__item">
|
||
<a class="post_tag-link" href="/tags/轮播图/">轮播图</a>
|
||
</ul>
|
||
|
||
|
||
<!-- Share -->
|
||
<button id="article-fuctions-share-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
|
||
<i class="material-icons" role="presentation">share</i>
|
||
<span class="visuallyhidden">share</span>
|
||
</button>
|
||
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-fuctions-share-button">
|
||
|
||
|
||
|
||
|
||
<!-- Share Weibo -->
|
||
|
||
<a class="post_share-link" href="http://service.weibo.com/share/share.php?appkey=&title=解析卡片式轮播图&url=/论轮播图的原理.html&pic=&searchPic=false&style=simple" target="_blank">
|
||
<li class="mdl-menu__item">
|
||
分享到微博
|
||
</li>
|
||
</a>
|
||
|
||
|
||
<!-- Share Twitter -->
|
||
|
||
<a class="post_share-link" href="https://twitter.com/intent/tweet?text=解析卡片式轮播图&url=/论轮播图的原理.html&via=Jzxer" target="_blank">
|
||
<li class="mdl-menu__item">
|
||
分享到 Twitter
|
||
</li>
|
||
</a>
|
||
|
||
|
||
<!-- Share Facebook -->
|
||
|
||
<a class="post_share-link" href="https://www.facebook.com/sharer/sharer.php?u=/论轮播图的原理.html" target="_blank">
|
||
<li class="mdl-menu__item">
|
||
分享到 Facebook
|
||
</li>
|
||
</a>
|
||
|
||
|
||
<!-- Share Google+ -->
|
||
|
||
|
||
<!-- Share LinkedIn -->
|
||
|
||
<a class="post_share-link" href="https://www.linkedin.com/shareArticle?mini=true&url=/论轮播图的原理.html&title=解析卡片式轮播图" target="_blank">
|
||
<li class="mdl-menu__item">
|
||
分享到 LinkedIn
|
||
</li>
|
||
</a>
|
||
|
||
|
||
<!-- Share QQ -->
|
||
|
||
<a class="post_share-link" href="http://connect.qq.com/widget/shareqq/index.html?site=Jzxer's Blog&title=解析卡片式轮播图&summary=web全栈工程师,音乐,电吉他,摇滚,html,css,javascript&pics=/img/favicon.ico&url=/论轮播图的原理.html" target="_blank">
|
||
<li class="mdl-menu__item">
|
||
分享到 QQ
|
||
</li>
|
||
</a>
|
||
|
||
|
||
<!-- Share Telegram -->
|
||
|
||
<a class="post_share-link" href="https://telegram.me/share/url?url=/论轮播图的原理.html&text=解析卡片式轮播图" target="_blank">
|
||
<li class="mdl-menu__item">
|
||
分享到 Telegram
|
||
</li>
|
||
</a>
|
||
|
||
</ul>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<!-- Post Content -->
|
||
<div id="post-content" class="mdl-color-text--grey-700 mdl-card__supporting-text fade out">
|
||
|
||
<script src="/assets/js/APlayer.min.js"> </script><blockquote>
|
||
<p>小记:前两天面试,展现项目过程中经理问我轮播图的原理,我一脸懵逼,因为当时有现成的插件,所以我没怎么去研究,当然,我也知道该来的还是要来的…</p>
|
||
</blockquote>
|
||
<p>首先我大概讲一下,传统轮播图的主要部分:</p>
|
||
<ul>
|
||
<li>图片(废话)</li>
|
||
<li>左右两边的button</li>
|
||
<li>可以跳转的小点<br><a href="http://jzxer.cn/card/" target="_blank" rel="noopener">demo</a></li>
|
||
</ul>
|
||
<h3 id="原理"><a href="#原理" class="headerlink" title="原理"></a>原理</h3><ul>
|
||
<li>轮播图的原理就是一个长图,里面有很多张图,外面包一层展示窗口,将属性设置成overflow:hidden,达到只显示一张的效果,当点击左右两边的按钮时会按照像素来跳转</li>
|
||
</ul>
|
||
<h3 id="无限滚动"><a href="#无限滚动" class="headerlink" title="无限滚动"></a>无限滚动</h3><ul>
|
||
<li>我给两个按钮设为 <b>prev next</b> 一个在点击后,长图会增加一张图的宽度,一个是减少一个图的宽度,在图片的头和尾部加一张图,结构大概为:<pre><code><div id="list" style="left:-200px">
|
||
<img src="./img/5.jpg" alt="">
|
||
<img src="./img/1.jpg" alt="">
|
||
<img src="./img/2.jpg" alt="">
|
||
<img src="./img/3.jpg" alt="">
|
||
<img src="./img/4.jpg" alt="">
|
||
<img src="./img/5.jpg" alt="">
|
||
<img src="./img/1.jpg" alt="">
|
||
</div>
|
||
</code></pre>当是最后一张图或第一张图时,将第一张上一张跳转为最后一张时的宽,最后一张跳转为第一张时的宽<pre><code>if (newList < -1000) {
|
||
dot = 1
|
||
list.style.left = -200 + 'px'
|
||
}
|
||
if (newList > -200) {
|
||
dot = 5
|
||
list.style.left = -1000 + 'px'
|
||
}
|
||
</code></pre></li>
|
||
</ul>
|
||
<h3 id="小按钮切换"><a href="#小按钮切换" class="headerlink" title="小按钮切换"></a>小按钮切换</h3><p>这要实现的思想有</p>
|
||
<ul>
|
||
<li>点了小按钮,背景色会变</li>
|
||
<li>当点击切换到其他按钮,图片切换,且上一个按钮会变回原来的颜色</li>
|
||
</ul>
|
||
<pre><code>function showBtn() {
|
||
for (var i = 0; i < btns.length; i++) {
|
||
if (btns[i].className == 'show-btn') {
|
||
btns[i].className = ''
|
||
break
|
||
}
|
||
}
|
||
btns[dot-1].className = 'show-btn'
|
||
}
|
||
//遍历数组,将有该属性设为空
|
||
|
||
for (var i = 0; i < btns.length; i++) {
|
||
btns[i].onclick = function () {
|
||
if (this.className == 'showBtn') {
|
||
return
|
||
}
|
||
var myIndex = parseInt(this.getAttribute('index'))
|
||
var leng = -200 * (myIndex - dot)
|
||
animate(leng)
|
||
dot = myIndex
|
||
showBtn()
|
||
}
|
||
}
|
||
//遍历数组,将每一个小按钮设了个index属性,这里用到 getAttribute 可以获取除了普通style 或 class 之外的一些属性,获取index值,点击时得到当前的index值,正好和当前的dot值相减,可得跳转的距离
|
||
</code></pre><blockquote>
|
||
<p>这里要注意的是,当小按钮被重复按的时候,给他一个判断,不然重复点击同一个图标会重复发生相同事件,占内存,耗cpu</p>
|
||
</blockquote>
|
||
<h3 id="延迟动画函数"><a href="#延迟动画函数" class="headerlink" title="延迟动画函数"></a>延迟动画函数</h3><p>就是当用户点击时,有一个慢慢偏移的过程,而不是闪现的动作,我们来看看实现原理</p>
|
||
<ul>
|
||
<li><p>首先,定义参数</p>
|
||
<pre><code>var time = 300 //位移总时间
|
||
var interval = 10 //位移时间间隔
|
||
var speed = leng/(time/interval) //每次位移量,就是一共调用多少次的意思
|
||
</code></pre></li>
|
||
<li><p>设置递归函数</p>
|
||
<pre><code>if ((speed < 0 && parseInt(list.style.left) > newList) || (speed > 0 && parseInt(list.style.left) < newList)) {
|
||
list.style.left = parseInt(list.style.left) + speed + 'px'
|
||
setTimeout(go, interval) //递归,调用自身函数
|
||
</code></pre></li>
|
||
<li><p>判断是否仍在动画<br>如果用户一直在点击切换图时,如果电脑配置不好,或是其他一些因素,可能会轮播卡顿,为了防止这一现象,就用一个判断来看上一次动画是否完成,若未完成就不能继续切换,等到这次动画跳转完为止<br>```<br>var animated = false //设初值</p>
|
||
</li>
|
||
</ul>
|
||
<p>if(!animated) {<br> animate(200)<br>} //如果为false,则继续动画</p>
|
||
<pre><code>
|
||
### 自动播放
|
||
首先给个思路,当鼠标移入的时候,自动播放停止,移出的时候开始自动播放
|
||
* 我们设两个函数,play() 和 stop()
|
||
</code></pre><p>function play() {<br> timer = setTimeout(function() {<br> next.onclick()<br> play()<br> },interval)<br> }<br> function stop() {<br> clearTimeout(timer)<br> }<br>```<br>给整个 container 容器添加该鼠标事件</p>
|
||
<p>这年头还是不能偷懒啊,说不定当时知道这个人家就把给我要了呢,好气哦…</p>
|
||
<blockquote>
|
||
<p>改天再研究下旋转木马的那种装个13…</p>
|
||
</blockquote>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<!-- Post Comments -->
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<!-- Post Prev & Next Nav -->
|
||
<nav class="material-nav mdl-color-text--grey-50 mdl-cell mdl-cell--12-col">
|
||
<!-- Prev Nav -->
|
||
|
||
<a href="/四种常见的布局.html" id="post_nav-newer" class="prev-content">
|
||
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
|
||
<i class="material-icons">arrow_back</i>
|
||
</button>
|
||
|
||
新篇
|
||
</a>
|
||
|
||
|
||
<!-- Section Spacer -->
|
||
<div class="section-spacer"></div>
|
||
|
||
<!-- Next Nav -->
|
||
|
||
<a href="/搭一个windows云服务器.html" id="post_nav-older" class="next-content">
|
||
旧篇
|
||
|
||
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
|
||
<i class="material-icons">arrow_forward</i>
|
||
</button>
|
||
</a>
|
||
|
||
</nav>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<!-- Overlay For Active Sidebar -->
|
||
<div class="sidebar-overlay"></div>
|
||
|
||
<!-- Material sidebar -->
|
||
<aside id="sidebar" class="sidebar sidebar-colored sidebar-fixed-left" role="navigation">
|
||
<div id="sidebar-main">
|
||
<!-- Sidebar Header -->
|
||
<div class="sidebar-header header-cover" style="background-image: url(/img/sidebar_header.png);">
|
||
<!-- Top bar -->
|
||
<div class="top-bar"></div>
|
||
|
||
<!-- Sidebar toggle button -->
|
||
<button type="button" class="sidebar-toggle mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" style="display: initial;" data-upgraded=",MaterialButton,MaterialRipple">
|
||
<i class="material-icons">clear_all</i>
|
||
<span class="mdl-button__ripple-container">
|
||
<span class="mdl-ripple">
|
||
</span>
|
||
</span>
|
||
</button>
|
||
|
||
<!-- Sidebar Avatar -->
|
||
<div class="sidebar-image">
|
||
<img src="/img/avatar.png" alt="Jzxer's avatar">
|
||
</div>
|
||
|
||
<!-- Sidebar Email -->
|
||
<a data-toggle="dropdown" class="sidebar-brand" href="#settings-dropdown">
|
||
710328466@qq.com
|
||
<b class="caret"></b>
|
||
</a>
|
||
</div>
|
||
|
||
|
||
<!-- Sidebar Navigation -->
|
||
<ul class="nav sidebar-nav">
|
||
<!-- User dropdown -->
|
||
<li class="dropdown">
|
||
<ul id="settings-dropdown" class="dropdown-menu">
|
||
|
||
<li>
|
||
<a href="710328466@qq.com" target="_blank" title="求实习工作">
|
||
|
||
<i class="material-icons sidebar-material-icons sidebar-indent-left1pc-element">email</i>
|
||
|
||
求实习工作
|
||
</a>
|
||
</li>
|
||
|
||
</ul>
|
||
</li>
|
||
|
||
<!-- Homepage -->
|
||
|
||
<li id="sidebar-first-li">
|
||
<a href="/">
|
||
|
||
<i class="material-icons sidebar-material-icons">home</i>
|
||
|
||
主页
|
||
</a>
|
||
</li>
|
||
|
||
<li class="divider"></li>
|
||
|
||
|
||
|
||
<!-- Archives -->
|
||
|
||
<li class="dropdown">
|
||
<a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
|
||
|
||
<i class="material-icons sidebar-material-icons">inbox</i>
|
||
|
||
归档
|
||
<b class="caret"></b>
|
||
</a>
|
||
<ul class="dropdown-menu">
|
||
<li>
|
||
<a class="sidebar_archives-link" href="/archives/2018/01/">一月 2018<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/12/">十二月 2017<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/11/">十一月 2017<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/10/">十月 2017<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/09/">九月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/08/">八月 2017<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/07/">七月 2017<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/06/">六月 2017<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/04/">四月 2017<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/03/">三月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/02/">二月 2017<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/01/">一月 2017<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/11/">十一月 2016<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/08/">八月 2016<span class="sidebar_archives-count">1</span></a>
|
||
</ul>
|
||
</li>
|
||
|
||
<li class="divider"></li>
|
||
|
||
|
||
|
||
<!-- Categories -->
|
||
|
||
<li class="dropdown">
|
||
<a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
|
||
|
||
<i class="material-icons sidebar-material-icons">chrome_reader_mode</i>
|
||
|
||
分类
|
||
<b class="caret"></b>
|
||
</a>
|
||
<ul class="dropdown-menu">
|
||
<li>
|
||
<a class="sidebar_archives-link" href="/categories/APP/">APP<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/CSS/">CSS<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/HTML/">HTML<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/IDE/">IDE<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/JS/">JS<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/categories/nodeJS/">nodeJS<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/storage/">storage<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/vue/">vue<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/web前端/">web前端<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/categories/web项目/">web项目<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/categories/博客搭建/">博客搭建<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/服务器/">服务器<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/版本管理/">版本管理<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/生活/">生活<span class="sidebar_archives-count">6</span></a></li><li><a class="sidebar_archives-link" href="/categories/音乐/">音乐<span class="sidebar_archives-count">6</span></a>
|
||
</ul>
|
||
</li>
|
||
|
||
<li class="divider"></li>
|
||
|
||
|
||
|
||
<!-- Pages -->
|
||
|
||
<li>
|
||
<a href="/gallery" title="图库">
|
||
|
||
<i class="material-icons sidebar-material-icons">dashboard</i>
|
||
|
||
图库
|
||
</a>
|
||
</li>
|
||
|
||
<li class="divider"></li>
|
||
|
||
|
||
<li>
|
||
<a href="/tags" title="标签">
|
||
|
||
<i class="material-icons sidebar-material-icons">label</i>
|
||
|
||
标签
|
||
</a>
|
||
</li>
|
||
|
||
<li class="divider"></li>
|
||
|
||
|
||
<li>
|
||
<a href="/about" title="前端求工作中">
|
||
|
||
<i class="material-icons sidebar-material-icons">face</i>
|
||
|
||
前端求工作中
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
<!-- Article Number -->
|
||
|
||
</ul>
|
||
|
||
|
||
<!-- Sidebar Footer -->
|
||
<!--
|
||
I'm glad you use this theme, the development is no so easy, I hope you can keep the copyright, I will thank you so much.
|
||
If you still want to delete the copyrights, could you still retain the first one? Which namely "Theme Material"
|
||
It will not impact the appearance and can give developers a lot of support :)
|
||
|
||
很高兴您使用并喜欢该主题,开发不易 十分谢谢与希望您可以保留一下版权声明。
|
||
如果您仍然想删除的话 能否只保留第一项呢?即 "Theme Material"
|
||
它不会影响美观并可以给开发者很大的支持和动力。 :)
|
||
-->
|
||
|
||
<!-- Sidebar Divider -->
|
||
|
||
|
||
<!-- Theme Material -->
|
||
|
||
<a href="https://github.com/viosey/hexo-theme-material" class="sidebar-footer-text-a" target="_blank">
|
||
<div class="sidebar-text mdl-button mdl-js-button mdl-js-ripple-effect sidebar-footer-text-div" data-upgraded=",MaterialButton,MaterialRipple">
|
||
主题 - Material
|
||
<span class="sidebar-badge badge-circle">i</span>
|
||
</div>
|
||
</a>
|
||
|
||
|
||
<!-- Help & Support -->
|
||
<!--
|
||
|
||
-->
|
||
|
||
<!-- Feedback -->
|
||
<!--
|
||
|
||
-->
|
||
|
||
<!-- About Theme -->
|
||
<!--
|
||
|
||
-->
|
||
|
||
</div>
|
||
|
||
<!-- Sidebar Image -->
|
||
|
||
|
||
</aside>
|
||
|
||
|
||
|
||
|
||
<!-- Footer Top Button -->
|
||
<div id="back-to-top" class="toTop-wrap">
|
||
<a href="#top" class="toTop">
|
||
<i class="material-icons footer_top-i">expand_less</i>
|
||
</a>
|
||
</div>
|
||
|
||
|
||
|
||
<!--Footer-->
|
||
<footer class="mdl-mini-footer" id="bottom">
|
||
|
||
<!-- Paradox Footer Left Section -->
|
||
<div class="mdl-mini-footer--left-section sns-list">
|
||
<!-- Twitter -->
|
||
|
||
|
||
<!-- Facebook -->
|
||
|
||
|
||
<!-- Google + -->
|
||
|
||
|
||
<!-- Weibo -->
|
||
|
||
<a href="http://weibo.com/5330486979/fans?topnav=1&wvr=6&mod=message&need_filter=1" target="_blank">
|
||
<button class="mdl-mini-footer--social-btn social-btn footer-sns-weibo">
|
||
<span class="visuallyhidden">Weibo</span>
|
||
</button><!--
|
||
--></a>
|
||
|
||
|
||
<!-- Instagram -->
|
||
|
||
|
||
<!-- Tumblr -->
|
||
|
||
|
||
<!-- Github -->
|
||
|
||
<a href="https://github.com/j710328466" target="_blank">
|
||
<button class="mdl-mini-footer--social-btn social-btn footer-sns-github">
|
||
<span class="visuallyhidden">Github</span>
|
||
</button><!--
|
||
--></a>
|
||
|
||
|
||
<!-- LinkedIn -->
|
||
|
||
<a href="http://www.linkedin.com/in/%E5%BF%97%E9%9B%84-%E6%B1%9F-338928105/" target="_blank">
|
||
<button class="mdl-mini-footer--social-btn social-btn footer-sns-linkedin">
|
||
<span class="visuallyhidden">LinkedIn</span>
|
||
</button><!--
|
||
--></a>
|
||
|
||
|
||
<!-- Zhihu -->
|
||
|
||
|
||
<!-- Bilibili -->
|
||
|
||
|
||
<!-- Telegram -->
|
||
|
||
</div>
|
||
|
||
|
||
<!--Copyright-->
|
||
<div id="copyright">
|
||
Copyright ©<script type="text/javascript">var fd = new Date();document.write(" " + fd.getFullYear() + " ");</script>Jzxer's Blog
|
||
</div>
|
||
|
||
<!-- Paradox Footer Right Section -->
|
||
|
||
<!--
|
||
I am glad you use this theme, the development is no so easy, I hope you can keep the copyright.
|
||
It will not impact the appearance and can give developers a lot of support :)
|
||
|
||
很高兴您使用该主题,开发不易,希望您可以保留一下版权声明。
|
||
它不会影响美观并可以给开发者很大的支持。 :)
|
||
-->
|
||
|
||
<div class="mdl-mini-footer--right-section">
|
||
<div>
|
||
<div class="footer-develop-div">Powered by <a href="https://hexo.io" target="_blank" class="footer-develop-a">Hexo</a></div>
|
||
<div class="footer-develop-div">Theme - <a href="https://github.com/viosey/hexo-theme-material" target="_blank" class="footer-develop-a">Material</a></div>
|
||
</div>
|
||
</div>
|
||
|
||
</footer>
|
||
|
||
|
||
<!-- Import File -->
|
||
|
||
|
||
<script>lsloader.load("js/lazyload.min.js","/js/lazyload.min.js?wgjW/HuQG9JDgvPDPoRAng==")</script>
|
||
<script>lsloader.load("js/js.min.js","/js/js.min.js?oAl/+lvaqTFV31JXTmbrNA==")</script>
|
||
|
||
|
||
|
||
<script>lsloader.load("js/nprogress.js","/js/nprogress.js?pl3Qhb9lvqR1FlyLUna1Yw==")</script>
|
||
|
||
|
||
<script type="text/ls-javascript" id="NProgress-script">
|
||
NProgress.configure({
|
||
showSpinner: true
|
||
});
|
||
NProgress.start();
|
||
$('#nprogress .bar').css({
|
||
'background': '#29d'
|
||
});
|
||
$('#nprogress .peg').css({
|
||
'box-shadow': '0 0 10px #29d, 0 0 15px #29d'
|
||
});
|
||
$('#nprogress .spinner-icon').css({
|
||
'border-top-color': '#29d',
|
||
'border-left-color': '#29d'
|
||
});
|
||
setTimeout(function() {
|
||
NProgress.done();
|
||
$('.fade').removeClass('out');
|
||
}, 800);
|
||
</script>
|
||
|
||
|
||
|
||
|
||
<script>lsloader.load("js/smoothscroll.js","/js/smoothscroll.js?tNQK2Tw2SUL8a1Scn/Mgew==")</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- UC Browser Compatible -->
|
||
<script>
|
||
var agent = navigator.userAgent.toLowerCase();
|
||
if(agent.indexOf('ucbrowser')>0) {
|
||
document.write('<link rel="stylesheet" href="/css/uc.css">');
|
||
alert('由于 UC 浏览器使用极旧的内核,而本网站使用了一些新的特性。\n为了您能更好的浏览,推荐使用 Chrome 或 Firefox 浏览器。');
|
||
}
|
||
</script>
|
||
|
||
<!-- Window Load-->
|
||
<script type="text/ls-javascript" id="window-load">
|
||
$(window).on('load', function() {
|
||
// Post_Toc parent position fixed
|
||
$('.post-toc-wrap').parent('.mdl-menu__container').css('position', 'fixed');
|
||
});
|
||
</script>
|
||
|
||
<!-- MathJax Load-->
|
||
|
||
<script type="text/ls-javascript" id="lazy-load">
|
||
// Offer LazyLoad
|
||
queue.offer(function(){
|
||
$('.lazy').lazyload({
|
||
effect : 'show'
|
||
});
|
||
});
|
||
|
||
// Start Queue
|
||
$(document).ready(function(){
|
||
setInterval(function(){
|
||
queue.execNext();
|
||
},200);
|
||
});
|
||
</script>
|
||
|
||
<!-- Bing Background -->
|
||
|
||
|
||
<script>
|
||
(function(){
|
||
var scriptList = document.querySelectorAll('script[type="text/ls-javascript"]')
|
||
|
||
for (var i = 0; i < scriptList.length; ++i) {
|
||
var item = scriptList[i];
|
||
lsloader.runInlineScript(item.id,item.id);
|
||
}
|
||
})()
|
||
console.log('\n %c © Material Theme | Version: 1.4.0 | https://github.com/viosey/hexo-theme-material %c \n', 'color:#455a64;background:#e0e0e0;padding:5px 0;border-top-left-radius:5px;border-bottom-left-radius:5px;', 'color:#455a64;background:#e0e0e0;padding:5px 0;border-top-right-radius:5px;border-bottom-right-radius:5px;');
|
||
</script>
|
||
|
||
</main>
|
||
</div>
|
||
</body>
|
||
|
||
</html>
|