APP 半自适应 WEB页面
特别赶,响应式纯自适应的,有空写了新的发。 (在手机上看,页面上看一定乱)
<!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页面的更多相关文章
- 用Chrome devTools 调试Android手机app中的web页面。
(1) 手机要满足Android系统为4.4或更高版本,低版本不支持这种方式.(2) 确保App已经开启了webview的debug调试模式,由Android工程师协助.(2) 用usb数据线连接好手 ...
- iOS之safari调试iOS app web页面
Overview 当下移动端开发过程中大量使用前段H5.js等等技术,而这些web页面的调试在Xcode控制台中不太明了,经常我们移动app运行了就是方法,但是不能显示响应的效果,这时候或许就是已经报 ...
- PhoneGap 白名单安全机制 navigator.app 加载外部页面返回以及退出介绍
一. Phonegap 白名单安全机制 Phonegap应用的页面大多存在于本地,但有时需要加载外部的Web页面到应用内置的浏览器 视图中已完成特定的应用功能,出于安全性考虑,PhoneGap 设立了 ...
- 客户端相关知识学习(一)之混合开发,为什么要在App中使用H5页面以及应用场景、注意事项
混合开发 随着移动互联网的高速发展,常规的开发速度已经渐渐不能满足市场需求.原生H5混合开发应运而生,目前,市场上许多主流应用都有用到混合开发,例如支付宝.美团等.下面,结合我本人的开发经验,简单谈一 ...
- safari 调试iPhone web页面
safari设置-打开Safari偏好者设置,选中“高级菜单”,在页面最下方看到“在菜单中显示开发菜单”的复选框,在复选框内打钩,这样设置完毕就能在Safari菜单中看到开发菜单了 iPhone 设置 ...
- appium处理app与web页面的转换
测微信页面的时候使用谷歌app,进入微信页面的链接 def setUp(self): print("set up env for android testing...") se ...
- phonegap(cordova)从手机app跳转到web页面在跳转回APP本地页面思路
项目中需要用到 WAP支付宝支付. 但是 使用PHONEGAP开发 跳转到支付宝支付,然后跳转回来 就回不到APP的本地页面, 就是使用WAP的第三方登录也是一样的.很难从WAP页面在跳转到 app本 ...
- 【web开发 | 移动APP开发】 Web 移动开发指南(2017.01.05更新)
版本记录 - 版本1.0 创建文章(2016.12.30) - 版本1.1 更正了hybird相关知识:增加了参考文章(2017.01.05): + Web APP更正为响应式移动站点与页面,简称响应 ...
- 移动端web页面如何适配
移动端web页面如何适配,现有两个方案: 1 设置viewport进行缩放 简单粗暴,使用过程中反应缩放会导致有些页面元素会糊的情况.天猫的web app的首页使用这种方案 在页面中加入viewpor ...
随机推荐
- win32使用拖放文件
于win32规划,使用拖放文件操作,非经常见(不否认有些人喜欢用button打开) 中使用拖拽,非常easy,仅仅须要在创建窗体的时候使用WS_EX_ACCEPTFILES标识符,然后使用一个消息函数 ...
- c#委托实例化和调用语句
系统訪问数据或调用方法有两种操作方式:一种是通过名称訪问或调用,还有一种是通过所在的内存地址来訪问调用.为了系统的安全与稳定,NET Framework的CLR库不同意程序通过指针来直接操作内存中数据 ...
- FTP定时批量下载文件(SHELL脚本及使用方法 ) (转)--good
#/bin/bash URL="http://192.168.5.100/xxx.php" check() { RESULT=$(curl -s $URL) echo $RESUL ...
- Android SystemUI源代码分析和修改
1.在导航栏中添加音量加减button 一些Android音量调节button.或者从保护实体按键的角度考虑,就须要在导航栏的虚拟按键中加入音量加减调节按键. 效果例如以下图所看到的: 实现步骤例如以 ...
- WCF搭建
WCF搭建 前言:前面三篇分享了下DDD里面的两个主要特性:聚合和仓储.领域层的搭建基本完成,当然还涉及到领域事件和领域服务的部分,后面再项目搭建的过程中慢慢引入,博主的思路是先将整个架构走通,然后一 ...
- [Visual Studio]透过Visual Studio 2012的选择性贴上将XML与JSON直接转成对应的类别
原文:[Visual Studio]透过Visual Studio 2012的选择性贴上将XML与JSON直接转成对应的类别 在开发专案时若碰到要串接服务或是他人的API,常常避免不了都要面对XML或 ...
- Git常用操作汇总(转)
如果一个文件被删除了,可以使用切换版本号进行恢复.恢复方法: 先确定需要恢复的文件要恢复成哪一个历史版本(commit),假设那个版本号是: commit_id,那么 git checkout com ...
- (大数据工程师学习路径)第二步 Vim编辑器----高级功能入门
一.多文件编辑 1.使用vim编辑多个文件 编辑多个文件有两种形式,一种是在进入vim前使用的参数就是多个文件.另一种就是进入vim后再编辑其他的文件. 同时创建两个新文件并编辑 $ vim 1.tx ...
- hdu 1150 Machine Schedule (经典二分匹配)
//A组n人 B组m人 //最多有多少人匹配 每人仅仅有匹配一次 # include<stdio.h> # include<string.h> # include<alg ...
- 网络资源(5) - Android视频
2014_08_24 http://v.youku.com/v_show/id_XMjM5NjU2OTI0.html?f=5486194 Android开发视频教程1 http://v.youku.c ...