APP semi-adaptive Web page

Source: Internet
Author: User

Special rush, responsive pure adaptive, have time to write a new hair. (See on the phone, the page must be messy)

<! DOCTYPE html>


<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<meta http-equiv= "x-ua-compatible" content= "ie=edge,chrome=1" >
<meta charset= "UTF-8" >
<meta content= "Initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" name= "viewport" >
<meta content= "yes" name= "apple-mobile-web-app-capable" >
<meta content= "Black" name= "Apple-mobile-web-app-status-bar-style" >
<meta content= "Telephone=no" name= "Format-detection" >
<meta http-equiv= "Cache-control" content= "No-transform" >
<meta http-equiv= "x-ua-compatible" content= "ie=edge,chrome=1" >


<script src= "Jquery-1.9.1.js" ></script>
<title> Seamless Connection scrolling </title>
<style>
html,body,ul,li{
margin:0; padding:0;
}
a{
Text-decoration:none;
}
#s_height ul li{
Z-index:9;
List-style-type:none;
Float:left;
Overflow:hidden;
Display:black;
}

#d_Layout ul li{
List-style-type:none;
Float:left;
Text-align:center;
}
#d_cilck {
width:100%;
}
#s_us {
right:20px; position:absolute; margin-top:-25px; z-index:999;
}
#s_us ul li{
List-style-type:none;
Float:left;
padding-left:15px;
}
#s_us ul li{
margin-left:15px;
border-radius:25px; border:2px solid #ffffff;p adding:5px;
}



</style>



<script>

$ (function () {
var t_name={
T_ lb:$ ("#s_Shell ul Li"),
s_h:$ ("#s_height"),
carousel_img:$ ("#s_heights ul Li"),
carousel_imgs:$ ("#s_ Heights ul li img "),
s_sc:$ (" #Seamless_carousel "),
s_ul:$ (" #s_us ul Li "),
s_slm:$ (". Slider-mains ")
};

//global variable, touch start position
var startx=0,starty=0,x=0,i=2,c=3,swidths= t_name.s_h.width ();
//touchstart event triggering event at touch start
Function Touchsatrtfunc (evt) {
Try
{
//evt.preventdefault ();//block touch when browser zoom, scroll bar scrolling, and so on
var touch = Evt.touches[0]; Gets the first contact
x = number (Touch.pagex);//page contact x-coordinate
//record contact initial position
StartX = x;
}
catch (E) {
Console.log (' touchsatrtfunc: ' + e.message);
}
}

Touchmove event, this event cannot get coordinates
function Touchmovefunc (evt) {
Try
{
Evt.preventdefault (); Browser zoom, scroll bar scrolling, and so on when blocking touch
var touch = evt.touches[0]; Get the first touch point
x = number (Touch.pagex); Page Contact X coordinate
var y = number (touch.pagey); Page Contact Y coordinate
}
catch (e) {
Console.log (' Touchsatrtfunc: ' + e.message);
}
}

The Touchend event triggers an event at the end of the touch
function Touchendfunc (evt) {
try {
Evt.preventdefault (); Browser zoom, scroll bar scrolling, and so on when blocking touch
T_CAROUSEL.Z_LB (T_NAME.T_LB,X<STARTX);
T_carousel.z_lz (T_NAME.T_LB,X>STARTX);
Window.clearinterval (Timeid);
Timeid=setinterval (function () {t_carousel.z_lb (t_name.t_lb,true)},4000);
}
catch (e) {
Console.log (' Touchendfunc: ' + e.message);
}
}

Binding events
function Bindevent () {
Document.addeventlistener (' Touchstart ', Touchsatrtfunc, false);
Document.addeventlistener (' Touchmove ', Touchmovefunc, false);
Document.addeventlistener (' Touchend ', Touchendfunc, false);
}

Determine if touch events are supported
function Istouchdevice () {
Console.log (navigator.appversion);
try {
Document.createevent ("TouchEvent");
Bindevent (); Binding events

}
catch (e) {
Console.log ("TouchEvent Event not supported! "+ e.message);
}
}

Window.onload = Istouchdevice;


var t_carousel={
Z_lb:function (t,z) {
if (z) {

if (i>=4) {

T_name.s_slM.stop (True). Animate ({"Margin-left": "-" + (i*swidths) + "px"},1000);
I=1;

T_name.s_slM.animate ({"Margin-left": "-" + (i*swidths) + "px"},0);
T_name.s_ul.eq (i-1). CSS ({"Transform": "Scale (1.1)", "Background-color": "#ffffff"}). Siblings (). css ({"Transform": " Scale (1) "," Background-color ":" Transparent "});
}else{
T_name.s_slM.animate ({"Margin-left": "-" + (i*swidths) + "px"},1000);
T_name.s_ul.eq (i-1). CSS ({"Transform": "Scale (1.1)", "Background-color": "#ffffff"}). Siblings (). css ({"Transform": " Scale (1) "," Background-color ":" Transparent "});

}
if (true) {

i==1?c=0:i==2?c=1:c=2;

}
if (i<=4) {
i++
}else{
i=5;
}
}

},
Z_lz:function (t,z) {
if (z) {
$ ("#sts"). CSS ("Display", "block");
T_name.s_ul.eq (c-1). CSS ({"Transform": "Scale (1.1)", "Background-color": "#ffffff"}). Siblings (). css ({"Transform": " Scale (1) "," Background-color ":" Transparent "});
if (c>=3) {
var t=c-3;
T_name.s_slM.stop (True). Animate ({"Margin-left": "-" + (t*swidths) + "px"},1000);

T_name.s_slM.animate ({"Margin-left": "-" + (c*swidths) + "px"},0);
}else{
T_name.s_slM.animate ({"Margin-left": "-" + (c*swidths) + "px"},1000);


}

c--;
if (true) {
if (c<=-1) {
I=1;
}else{
c==2?i=4:c==1?i=3:i=2;}
}
if (c>1) {

c=2;

}
if (c<0)
{
c=3;
}
}


}
}

function Automatic_at () {
var swidth= t_name.s_h.width ();
var swidthto=number (swidth* (5/8));

T_name.s_Sc.attr ("Style", "width:" +swidth+ "Px;overflow:hidden;");
T_name. Carousel_img.attr ("style", "Height:" +swidthto+ "Px;width:" +swidth+ "px;min-height:80px;");
T_name. Carousel_imgs.attr ("style", "Height:" +swidthto+ "Px;width:" +swidth+ "px;min-height:80px;");
T_name.s_h.attr ("style", "Height:" +swidthto+ "px;width:100%;min-height:80px;");
$ ("#sts"). attr ("Style", "width:" +swidth+ "Px;overflow:hidden; display:none;");
$ (". Slider-mains"). attr ("style", "margin-left:-500px;");
}

$ (window). Resize (function () {
Automatic_at ();
});

Automatic_at ();
Timeid=setinterval (function () {t_carousel.z_lb (t_name.t_lb,true)},4000);
});



</script>

<body>
<div id= "S_shell" >
<div id= "S_height" class= "S_width" >
<div id= "Seamless_carousel" >
<div id= "s_heights" style= "width:4000px; Overflow:hidden; ">
<ul class= "Slider-mains" >
<li ></li>
<li ></li>
<li ></li>
<li ></li>
<li ></li>
</ul>
</div>
</div>
</div>
<div id= "S_us" >
<ul>
<li style= "Background-color: #ffffff; Transform:scale (1.1); " ><div ></div> </li>
<li><div ></div> </li>
<li><div ></div> </li>
</ul>
</div>


</body>

APP semi-adaptive Web page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.