特别赶,响应式纯自适应的,有空写了新的发。 (在手机上看,页面上看一定乱)

<!DOCTYPE html>
<html>
<head>
<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>无缝连接滚动</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;padding:5px;
}

</style>

</head>

<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")
};

//全局变量,触摸开始位置
var startX=0,startY=0,x=0,i=2,c=3,sWidths= t_name.s_h.width();
//touchstart事件 在触摸开始时触发事件
function touchSatrtFunc(evt){
try
{
//evt.preventDefault(); //阻止触摸时浏览器的缩放、滚动条滚动等
var touch = evt.touches[0]; //获取第一个触点
x = Number(touch.pageX); //页面触点X坐标
//记录触点初始位置
startX = x;
}
catch (e) {
console.log('touchSatrtFunc:' + e.message);
}
}

//touchmove事件,这个事件无法获取坐标
function touchMoveFunc(evt) {
try
{
//evt.preventDefault(); //阻止触摸时浏览器的缩放、滚动条滚动等
var touch = evt.touches[0]; //获取第一个触点
x = Number(touch.pageX); //页面触点X坐标
var y = Number(touch.pageY); //页面触点Y坐标
}
catch (e) {
console.log('touchSatrtFunc:' + e.message);
}
}

//touchend事件 在触摸结束时触发事件
function touchEndFunc(evt) {
try {
//evt.preventDefault(); //阻止触摸时浏览器的缩放、滚动条滚动等
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);
}
}

//绑定事件
function bindEvent() {
document.addEventListener('touchstart', touchSatrtFunc, false);
document.addEventListener('touchmove', touchMoveFunc, false);
document.addEventListener('touchend', touchEndFunc, false);
}

//判断是否支持触摸事件
function isTouchDevice(){
console.log(navigator.appVersion);
try {
document.createEvent("TouchEvent");
bindEvent(); //绑定事件

}
catch (e) {
console.log("不支持TouchEvent事件!" + 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 ><img id="sts" class="s_width" src=" img/item2.jpg"/></li>
<li ><img class="s_width" src=" img/ss.png"/></li>
<li ><img class="s_width" src=" img/item1.jpg"/></li>
<li ><img class="s_width" src=" img/item2.jpg"/></li>
<li ><img class="s_width" src=" img/ss.png"/></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>
</html>

APP 半自适应 WEB页面的更多相关文章

  1. 用Chrome devTools 调试Android手机app中的web页面。

    (1) 手机要满足Android系统为4.4或更高版本,低版本不支持这种方式.(2) 确保App已经开启了webview的debug调试模式,由Android工程师协助.(2) 用usb数据线连接好手 ...

  2. iOS之safari调试iOS app web页面

    Overview 当下移动端开发过程中大量使用前段H5.js等等技术,而这些web页面的调试在Xcode控制台中不太明了,经常我们移动app运行了就是方法,但是不能显示响应的效果,这时候或许就是已经报 ...

  3. PhoneGap 白名单安全机制 navigator.app 加载外部页面返回以及退出介绍

    一. Phonegap 白名单安全机制 Phonegap应用的页面大多存在于本地,但有时需要加载外部的Web页面到应用内置的浏览器 视图中已完成特定的应用功能,出于安全性考虑,PhoneGap 设立了 ...

  4. 客户端相关知识学习(一)之混合开发,为什么要在App中使用H5页面以及应用场景、注意事项

    混合开发 随着移动互联网的高速发展,常规的开发速度已经渐渐不能满足市场需求.原生H5混合开发应运而生,目前,市场上许多主流应用都有用到混合开发,例如支付宝.美团等.下面,结合我本人的开发经验,简单谈一 ...

  5. safari 调试iPhone web页面

    safari设置-打开Safari偏好者设置,选中“高级菜单”,在页面最下方看到“在菜单中显示开发菜单”的复选框,在复选框内打钩,这样设置完毕就能在Safari菜单中看到开发菜单了 iPhone 设置 ...

  6. appium处理app与web页面的转换

      测微信页面的时候使用谷歌app,进入微信页面的链接 def setUp(self): print("set up env for android testing...") se ...

  7. phonegap(cordova)从手机app跳转到web页面在跳转回APP本地页面思路

    项目中需要用到 WAP支付宝支付. 但是 使用PHONEGAP开发 跳转到支付宝支付,然后跳转回来 就回不到APP的本地页面, 就是使用WAP的第三方登录也是一样的.很难从WAP页面在跳转到 app本 ...

  8. 【web开发 | 移动APP开发】 Web 移动开发指南(2017.01.05更新)

    版本记录 - 版本1.0 创建文章(2016.12.30) - 版本1.1 更正了hybird相关知识:增加了参考文章(2017.01.05): + Web APP更正为响应式移动站点与页面,简称响应 ...

  9. 移动端web页面如何适配

    移动端web页面如何适配,现有两个方案: 1 设置viewport进行缩放 简单粗暴,使用过程中反应缩放会导致有些页面元素会糊的情况.天猫的web app的首页使用这种方案 在页面中加入viewpor ...

随机推荐

  1. Android中的表格布局TableLayout

    表格布局最基本的三个属性: XML代码实例: <?xml version="1.0" encoding="utf-8"?> <LinearLa ...

  2. JAVA对数据库进行操作,实现数据库中数据的插入,查询,更改,删除操作

    (—)通过mysql workbench 创建一个数据库,在这里命名为company,然后建一个tb_employee表 (二)以下是java代码对表tb_employee的操作 1 创建一个Empl ...

  3. Extjs GridPanel 几点说明

    1. 在Ext中,表格控件必须包括列定义信息,并指定表格的数据存储器.列信息由columns定义,而数据存储器有store定义. 2. store负责把各种各样的原始数据(JSON对象数组等等)转换成 ...

  4. fragment 中利用spinner实现省市联动

    (1)布局文件就不在说明了,主要说代码的实现,先把代码贴上! package com.example.cl; import android.annotation.SuppressLint; impor ...

  5. Android MotionEvent事故响应机制

    于android于.主要活动包括点击.按.拖累.滑动等操作,这些构成了Android事件响应,总体而言,,所有事件由例如以下三部分构成的基础: 按(action_down),搬家(action_mov ...

  6. Codeforces 487C. Prefix Product Sequence 逆+结构体

    意甲冠军: 对于数字n, 他询问是否有1~n置换 这种布置能够在产品上模每个前缀n 有可能0~n-1 解析: 通过观察1肯定要在首位,n一定要在最后 除4意外的合数都没有解 其它质数构造 a[i]=i ...

  7. C++11于once_flag,call_once分析的实现

    基于该分析llvm的libc++,代替gun的libstdc++,由于libstdc++的代码里太多宏了,看起来蛋疼. 在多线程编程中,有一个常见的情景是某个任务仅仅须要运行一次.在C++11中提供了 ...

  8. SICP 习题 (1.37)解题总结

    SICP 习题 1.37是一条非常长的题目,主要讲的是无穷连分式.无穷连分式对我来说又是一个陌生的概念,于是又去百度了一番,发现无穷连分式也是一个非常有意思的话题,涉及到无理数的表达.只是我建议大家还 ...

  9. java两个音频进入巩固期 玩的同时类似的伴奏

    /** * * @param partsPaths 阵列要合成音频路径 * @param unitedFilePath 输入合并结果数组 */ public void uniteWavFile(Str ...

  10. QtQuick桌面应用程序开发指导 3)达到UI而功能_B 4)动态管理Note物_A

    3.2 把Page Item和Marker Item绑定 之前我们实现了PagePanel组件, 使用了三个state来切换Page组件的opacity属性; 这一步我们会使用Marker和Marke ...