Use Zepot to make a carousel diagram
<meta charset= "Utf-8" >
<meta name= "viewport" content= "Width=device-width, User-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0 ">
<TITLE>JD Home </title>
<link rel= "stylesheet" href= "Css/base.css" >
<link rel= "stylesheet" href= "Css/index.css" >
<!--using mobile Zepto must be introduced--
<script src= ' js/zepto/zepto.min.js ' ></script>
<!--using mobile animation must be introduced--
<script src= ' js/zepto/fx.js ' ></script>
<!--swipe needs to be introduced--
<script src= ' js/zepto/touch.js ' ></script>
<script>
$ (function () {
Carousel Map Parent Box ul
var lunbo=$ ('. Lunbo ');
Index of the Carousel map ul
var selection=$ ('. Selection ');
Width
var banner_width=$ ('. Banner '). width ();
var index=1;
Multiple occurrences, encapsulated into functions
var automove=function () {
Lunbo.animate ({' Transform ': ' TranslateX (' +index*-banner_width+ ' px) '},300, ' ease ', function () {
if (index>=9) {
Index=1;
Lunbo.css ({
' Transform ': ' TranslateX (' +index*-banner_width+ ' px) '
})
}else if (index<=0) {
index=8;
Lunbo.css ({
' Transform ': ' TranslateX (' +index*-banner_width+ ' px) '
})
}
Let the index follow the rotation graph changes, the carousel diagram is left and right each add a graph, index is 1 o'clock, small icon index is index-1
Selection.children (' Li '). Removeclass (' Now '). EQ (index-1), addclass (' Now ');
if (Timerid = = undefined) {
Timerid = setinterval (function () {
index++;
Automove ();
}, 1000);
}
});
}
Timer
var timerid=setinterval (function () {
index++;
Automove ();
},1000);
Left slide, need to clear the timer
$ ('. Lunbo '). Swipeleft (function () {
Clearinterval (Timerid);
timerid=undefined;
index++;
Automove ();
})
Right slide, need to clear timer
$ ('. Lunbo '). Swiperight (function () {
Clearinterval (Timerid);
timerid=undefined;
index--;
Automove ();
})
})
</script>
<body>
Use Zepot to import different events according to the events used js,[' swipe ', ' swipeleft ', ' swiperight ', ' swipeup ', ' Swipedown ',
' Doubletap ', ' tap ', ' Singletap ', ' Longtap ' and other events]tap is a click event in Zepot
Media queries (Implementation of the response) can adjust different styles depending on the screen size media queries
Need to have a container class,
@media screen and (min-width:600px) and (max-width:900px) {
. container{
width:100%;
max-width:650px;
Background-color:hotpink;
}
}
format, note and before and after there are spaces, can not write, can not miss write. container{}
Bootstrap's URL www.bootcss.com
Now the most practical development is 3.3.5 version, 2 version is compatible with IE, the previous use of many,
Template page for Bootstrap
<! DOCTYPE Html>
<!--the language of the website is Chinese-->
<!--encoding format is utf-8-->
<meta charset= "Utf-8"
<!--using the latest IE kernel rendering
Some of the so-called dual-core The browser either uses the WebKit directly to render the
-->
<meta http-equiv= "x-ua-compatible" content= "Ie=edge";
<!--viewport properties
There is no setting to disable user scaling, add
--> if required,
<meta name= "viewport" content= "Width=device-width, initial-scale=1, User-scalable=no ">-------------------------------1
<!--above 3 META tags * must be * placed first, any other content * must * follow! -->
<title>bootstrap template page </title>
<!--Bootstrap-->
<link href= "lib/css/ Bootstrap.min.css "rel=" stylesheet ">-----------------------------------2
<!--
Media queries medium query
- ->
<!--HTML5 Shim and Respond.js for IE8 support of HTML5 elements and media queries-->
<!--WARNING : Respond.js doesn ' t work if you view the page via file://-->
<!--hack notation when LT less than is smaller than IE9-->
<!--[if Lt IE 9]>------------------------------------------------------------------------------------------ ---7
<script src= "Lib/js/html5shiv.js" ></script>------------------------------------3
<script src= "Lib/js/respond.js" ></script>-------------------------------------4
<! [endif]-->
<body>
</body>
<!--jQuery (necessary for Bootstrap ' s JavaScript plugins) Bootstrap is JQ--
<script src= "Lib/js/jquery.min.js" ></script>---------------------------------------------5
<!--Include all compiled plugins (below), or include individual files as needed import the boot some JS---
<script src= "Lib/js/bootstrap.min.js" ></script>----------------------------------------------6
may need to change 6 places, the first is based on the need to adapt to the width, 2-6 are the path to note, 7 is hack, not a comment (less than IE9)
Lib folder do not forget to create, import icons need to introduce Fonts folder, the first three meta tags must have, must be in the front of the meta
Bootstrap is based on jquery, so you must first introduce JQ
Grid system
Need to add a class for Container-fluid or container parent element, Container-fluid width of the parent element 100%,container width is fixed width, can be divided into 12 parts, more than 12 copies, will be another row, The principle of internal implementation is the float
Cells need to be placed in a container of class = row, and each cell is set with a ' col-xx-' number, where xx is xs,sm,md,lg in order from small to large ... XS is resolution <768PX,SM resolution <992PX and >=768,MD resolution <1200 and >=992,LG resolution >=1200, see website www.bootcss.com for details
<div class= ' Container-fluid ' >
<div class= "Row Myrow" >
<div class= "col-md-2 col-sm-4 col-xs-7" >.col-md-1</div>
<div class= "col-md-3 col-sm-4 col-xs-3" >.col-md-1</div>
<div class= "col-md-7 col-sm-4 col-xs-2" >.col-md-1</div>
</div>
Hidden-xs indicates that the XS size is hidden when multiple dimensions are required to hide the need to write multiple similar hidden
Icons and styles see site, icons need to add an icon name of class, style can be modified according to the reference code to use
Add a button class to the <a>, <button>, or <input> elements (button Class) to use the styles provided by Bootstrap.
<a class= "btn Btn-default" href= "#" role= "button" >Link</a>
<button class= "btn Btn-default" type= "Submit" >Button</button>
<input class= "btn btn-default" type= "button" value= "Input" >
<input class= "btn Btn-default" type= "Submit" value= "Submit" >
Mobile-zepot& Media queries