1. 程式人生 > >HTML標簽marquee實現滾動效果

HTML標簽marquee實現滾動效果

int pro return set gin 緩存 wip select lex

<?php
include "../library/mFunction.php";

/**************選取商品一級分類**********/
$result=mysql_query("select * from goodsOne where xian=‘顯示‘ order by list desc limit 3");
while ($res = mysql_fetch_array($result)) {
$goodsOne[]=$res;
}

echo mHead();
?>
<!--頭部-->
<div class="header header-fixed">

<div class="nesting"> <a href="JavaScript:;" class="header-btn header-return"><span class="return-ico"></span></a>
<div class="align-content">
<p class="align-text">曦億騰網絡科技有限公司</p>
</div>
<a href="#" class="header-btn"></a>
</div>
</div>
<!--//-->
<div class="container mui-mbottom60">
<div class="content mui-ptop45">
<!--輪播-->
<div id="slideBox" class="slideBox">
<div class="swiper-wrapper">
<div class=‘swiper-slide‘>
<a href=‘‘><img src=‘<?php echo img(‘soL89312338hy‘);?>‘></a>
</div>
<div class=‘swiper-slide‘>
<a href=‘‘><img src=‘<?php echo img(‘soL89312338hy‘);?>‘></a>
</div>
<div class=‘swiper-slide‘>
<a href=‘‘><img src=‘<?php echo img(‘soL89312338hy‘);?>‘></a>
</div>
<div class=‘swiper-slide‘>
<a href=‘‘><img src=‘<?php echo img(‘soL89312338hy‘);?>‘></a>
</div>
</div>
<div class="swiper-pagination"> </div>
</div>
<!--//-->
</div>
<!--產品列表-->
<!--產品導航-->

<!---->
<div class="product">
<!--類別-->
<div class="row product">
<?php
//循環一級分類
foreach($goodsOne as $key =>$value){
?>
<div class="key_title"><?php echo $value[‘name‘];?></div>
<ul class="product-lists mui-dis-flex">
<?php
//循環一級分類產品
$result=mysql_query("select * from goods where goodsOneId=‘$value[id]‘and xian=‘顯示‘ order by list desc limit 6");
$goods=array();
while($res = mysql_fetch_array($result))
{
$goods[]=$res;
}

foreach($goods as $k=>$v){
$goodsSku = query(‘goodsSku‘, "goodsId=‘$v[id]‘");

?>
<li>
<a href="<?php echo root;?>m/mGoodsMx.php?goodsId=<?php echo $v[id];?>">
<img src="<?php echo $root.$v[‘ico‘];?>"/>
<p class="nameSpc"><?php echo $v[‘name‘];?></p>
<p class="textSale">
<em class="text-price">¥<?php echo $goodsSku[‘price‘];?></em>
<!--<em class="text-sale">銷量:60</em> -->
</p>
</a>
</li>
<?php } ?>

</ul>
<?php } ?>

<!--//-->
</div>
<!--回到頂部-->
<a href="javascript:;" title="回到頂部" id="gotop-btn"><img src="<?php echo img(‘ffJ89313313Ft‘);?>"/></a>
<!--//-->
</div>
<!--底部-->
<?php echo warn().mFooter();?>
<!--//-->
<script>
$(function(){
/****導航欄變色***/
changeNav();
});
/****首頁輪播****/
window.addEventListener("load", function(e) {
// 首頁輪播圖
var swiperObj = new Swiper(‘#slideBox‘, {
autoplay: 2500,
autoplayDisableOnInteraction: false,
loop: true,
pagination: ‘.swiper-pagination‘,
});
}, false);
/****回到頂部****/
window.onload=function(){
var gotop_btn = document.getElementById("gotop-btn");//獲取回到頂部按鈕ID
var clientHeight = document.documentElement.client;//獲取可視區域的高度
var timer = null;//定義一個定時器
var isTop = true;//定義一個布爾值,判斷是否到達頂部

window.onscroll = function(){ //滾動事件
//獲取滾動條的滾動高度
var osTop = document.documentElement.scrollTop || document.body.scrollTop;

//判斷回到頂部按鈕的顯示與隱藏
if(osTop > 0){
gotop_btn.style.display = "block";
}else{
gotop_btn.style.display = "none";
}

//主要用於判斷當 點擊回到頂部按鈕後 滾動條在回滾過程中,若手動滾動滾動條,則清除定時器
if(!isTop){
clearInterval(timer);
}
isTop = false;
}

//回到頂部點擊事件
gotop_btn.onclick = function(){
//設置一個定時器
timer = setInterval(function(){
//獲取滾動條的高度
var osTop = document.documentElement.scrollTop || document.body.scrollTop;
//用於設置速度差 用於產生緩存效果
var speed = Math.floor(-osTop / 8);
document.documentElement.scrollTop = document.body.scrollTop = osTop + speed;
isTop =true; //用於阻止滾動事件清除定時器
if(osTop == 0){
clearInterval(timer);
}
},30);
}
}
</script>

HTML標簽marquee實現滾動效果