html5上下滑动“翻页”实现,是真正的翻页

html5上下滑动“翻页”实现,是真正的翻页,第1张

HTML5手机上下滑动翻页特效是一款手机移动端触屏滑动效果实现完整代码如下:

1、html5页面代码

<!DOCTYPE html>

<html><head><meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8">

<title>HTML5手机页面触屏滑动上下翻页特效</title>

<meta charset="utf-8">

<meta name="apple-touch-fullscreen" content="YES">

<meta name="format-detection" content="telephone=no">

<meta name="apple-mobile-web-app-capable" content="yes">

<meta name="apple-mobile-web-app-status-bar-style" content="black">

<meta http-equiv="Expires" content="-1">

<meta http-equiv="pragram" content="no-cache">

<link rel="stylesheet" type="text/css" href="./hamer_files/main.css">

<link rel="stylesheet" type="text/css" href="./hamer_files/endpic.css">

<script type="text/javascript" src="./hamer_files/offline.js"></script>

<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">

</head>

<body class="s-bg-ddd pc no-3d perspective yes-3d" style="-webkit-user-select: none">

  <section class="u-alert">

      <img style="display:none" src="./hamer_files/loading_large.gif">

      <div class="alert-loading z-move">

          <div class="cycleWrap"> <span class="cycle cycle-1"></span>

              <span class="cycle cycle-2"></span><span class="cycle cycle-3"></span><span class="cycle cycle-4"></span>

          </div>

          <div class="lineWrap"> <span class="line line-1"></span><span class="line line-2"></span><span class="line line-3"></span>

          </div>

      </div>

  </section>

  <section class="u-arrow">

      <p class="css_sprite01"></p>

  </section>

  <section class="p-ct transformNode-2d transformNode-3d" style="height: 918px">

      <div class="translate-back" style="height: 918px">

          <div class="m-page m-fengye" data-page-type="info_pic3" data-statics="info_pic3" style="height: 918px">

              <div class="page-con lazy-finish" data-position="50% 50%" data-size="cover" style="height: 920pxbackground-image: url(hamer_files/1.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/2.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/3.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/4.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/5.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/6.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/7.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

          <div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">

              <div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/8.jpg)background-size: coverbackground-position: 50% 50%"></div>

          </div>

      </div>

  </section>

  <section class="u-pageLoading">

      <img src="./hamer_files/load.gif" alt="loading">

  </section>

  <script src="./hamer_files/init.mix.js" type="text/javascript" charset="utf-8"></script>

  <script src="./hamer_files/coffee.js" type="text/javascript" charset="utf-8"></script>

  <script src="./hamer_files/99_main.js" type="text/javascript" charset="utf-8"></script>

</body></html>

2、css代码:

@charset "utf-8"

.ad_foot li { margin:0 auto 1emfont-size:1.8empadding:15pxbackground:#FFF}

.ad_foot li a {display:block}

.ad_foot li .l {width:75pxheight:75pxfloat:leftoverflow:hidden}

.ad_foot li .l img {width:75pxwidth:75px}

.ad_foot li .r {width:78%float:leftmargin-left:30pxcolor:#666overflow:hidden}

.ad_foot li .r p {color:#999font-size:1.2em}

.ad_foot li .r span {font-size:0.8em}

.ad_foot li .r i {font-style:normal}

.lazy-img, .lazy-finish{background-color:#f0eded}

.page-list{font-size:20pxfont-family: "Microsoft yahei"padding-left:17pxpadding-top:30pxheight:35pxborder-bottom:1px solid #b5b5b5display:none}

.ad_foot{padding:15px 15px 0 15px}

/*声音播放按钮*/

#song_img {width:293pxheight:41pxdisplay:blockposition:absoluteright:4.1emtop:1.6emfont-size:1.7emtext-align:centerline-height:41pxcolor:#FFFbackground:url(../img/music_c3.png) no-repeat 0 0}

/*底部推荐*/

.ad_list{margin-top:2em}.ad_list li {width:46%background:nonepadding:0float:leftmargin-bottom: 1em}

.ad_list li.r {float:right}.ad_list li a img {width:100%height:auto}

.ad_foot h3 {width:100%height:48pxline-height:48pxbackground:#F9F5EC}

.ad_foot h3 a {display:inline-blockcolor:#444width:50%text-align:centerfont-size:1.5emheight:48pxborder-bottom:2px solid #FF9240}

.ad_foot h3 a.active {color:#FFFbackground:#FF9240}

.magazine_1 li {

width:100%

margin-bottom: 1em

font-size: 1.8em

padding: 15px

background: #FFF}

.magazine_1 li a {display:block}

.magazine_1 li .l {width: 75px

height: 75px

float: left

overflow: hidden}

.magazine_1 li .l img {width:75pxheight:75px}

.magazine_1 li .r {width: 78%

float: left

margin-left: 30px

color: #666

overflow: hidden}

.magazine_1 li .r p {

color: #999

font-size: 1.2em

.magazine_1 li .r span {font-size:0.8em}

.ad_foot li .r i {font-style:normal}

3、运行效果如下:

静态网页制作起来 相当麻烦。。你必须对应到相应的链接才行。。你可以试试静态网页中的

FRAMESET标签。。分成2-3个框架。。最上面的框架做导航。。下面做次导航 右下做浏览你网页内容的。。这样划拨一样就不会显得那么麻烦了。。不过工作量还是相当大的。你也可以在主页加入一些JAVASCRIPT那样这个网页就固定添加一个脚本。进入其他子页也同样有,可以实现网页的美化和更加方便。。

PHP的

<?php

include_once("../../config/config.php")

$conn = mysql_connect ($DBhost, $DBuser, $DBpaswd) or die("fail to connect to db")

mysql_select_db($DBname) or die("fail to select db")

$str = $_GET['page']

if($str <1)

{

$str = "1"

}

$page = intval($str)//which page

$msg_count = mysql_query("select count(id) as rscont from message")

$rs_count = 0

while($ro = mysql_fetch_object($msg_count))

{

$rs_count = $ro->rscont

}//total data

$pagesize=5//total page

$sql="select * from message order by con_time DESC limit ".($page-1) * $pagesize.",".$pagesize.""

mysql_query("set names 'utf8'")

$result=mysql_query ($sql) or die("fail to query")

$pagecount=0

if(($rs_count/$pagesize)!=0)

{

$pagecount=intval($rs_count/$pagesize)+1

}

else

{

$pagecount=$rs_count/$pagesize

}

if($page<1)

{

$page=1

}

else

{

if($page>$pagecount)

{

$page=$pagecount

}

}

if (mysql_num_rows($result)>0){

$msg_no = 1//message number. TBD,num should be plus after change page

while($row=mysql_fetch_object($result)){

?>

<div id="each-content">

<div id="title">

<div id="content-header" >

<span>#:<?php echo "$msg_no" ?></span>

<span class="content-name">By: <?php echo "$row->username" ?></span>

<span class="content-time">Create at: <?php echo "$row->con_time" ?></span>

</div>

</div>

<div id="content-body">

<div class="DivUnderline">

<table width="100%"><tr><td>Title: <span id="msg_title_"><?php echo "$row->con_title" ?></span></td>

<td style="text-align:right">

<a name="msg_updates_<?php echo "$row->id" ?>" style="display:none" href="message_update.php?id=<?php echo "$row->id" ?>">[update]</a>

<a name="msg_deletes" style="display:none" href="message_delete.php?id=<?php echo "$row->id" ?>">[delete]</a>

</td></tr></table>

<hr>

</div>

<div class="DivNotification"><?php echo "$row->content"?></div>

</div>

<div id="reply">

<span class="content-name">Admin replay:<br/></span><span id="reply-content"><?php echo "$row->reply" ?></span>

</div>

</div>

<?php

$msg_no++

}

}

else

{

?>

<span>There is no message in this page!</span>

<?php

}

//show update button and delete button

include "message_buttons.php"

?>

<div id="fenye">

Current page[<?php echo $page."/".$pagecount ?>]

<a href="message_index.php?page=1">[First page]</a>

<a href="message_index.php?page=<?php echo $page-1 ?>">[Last page]</a>

<a href="message_index.php?page=<?php echo $page+1 ?>">[Next page]</a>

<a href="message_index.php?page=<?php echo $pagecount ?>">[End]</a>

</div>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7407407.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-05
下一篇 2023-04-05

发表评论

登录后才能评论

评论列表(0条)

保存