純js+css實(shí)現(xiàn)仿移動(dòng)端淘寶網(wǎng)站的彈出詳情框功能
點(diǎn)擊查看圖片
代碼
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no, viewport-fit=cover">
<style>
body{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#content{
width: 100%;
height: 10rem;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
background: skyblue;
position: fixed;
left: 0;
right: 0;
bottom: -10rem;
margin: 0 auto;
text-align: center;
line-height: 10rem;
}
@keyframes slideUp {
from{
bottom: -10rem;
}
to{
bottom: 0;
}
}
@keyframes slideDown {
from{
bottom: 0;
}
to{
bottom: -10rem;
}
}
#content img{
width: 1.2rem;
height: 1.2rem;
position: absolute;
right: 10px;
top: 10px;
}
</style>
</head>
<body>
<div id="main">
<a href="#" rel="external nofollow" id="a">點(diǎn)擊彈出</a>
</div>
<div id="content">
測(cè)試區(qū)域
<img src="images/close.png" alt="" id="close">
</div>
</body>
<script>
var show = document.getElementById("a");
var close = document.getElementById("close");
var content = document.getElementById("content");
var main = document.getElementById("main");
document.onclick = function () {
content.style.animation = "slideDown 0.5s 1 normal forwards";
main.style.opacity = "1";
};
close.addEventListener("click",function () {
content.style.animation = "slideDown 0.5s 1 normal forwards";
main.style.opacity = "1";
});
show.addEventListener("click",function (e) {
stopFunc(e);
content.style.animation = "slideUp 0.5s 1 normal forwards";
main.style.opacity = "0.5";
},false);
content.addEventListener("click",function (e) {
stopFunc(e);
},false);
//阻止事件向下傳遞
function stopFunc(e) {
e.stopPropagation() ? e.stopPropagation() : e.cancelBubble = true;
}
</script>
</html>
總結(jié)
以上所述是小編給大家介紹的純js+css實(shí)現(xiàn)仿移動(dòng)端淘寶網(wǎng)站的彈出詳情框功能,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)我們網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
上一篇:node.js Promise對(duì)象的使用方法實(shí)例分析
欄 目:JavaScript
下一篇:JavaScript獲取當(dāng)前url路徑過(guò)程解析
本文標(biāo)題:純js+css實(shí)現(xiàn)仿移動(dòng)端淘寶網(wǎng)站的彈出詳情框功能
本文地址:http://www.jygsgssxh.com/a1/JavaScript/9372.html
您可能感興趣的文章
- 04-02java后端代碼分頁(yè) java后端實(shí)現(xiàn)分頁(yè)page
- 01-10Echarts實(shí)現(xiàn)單條折線可拖拽效果
- 01-10在Vue項(xiàng)目中使用Typescript的實(shí)現(xiàn)
- 01-10js實(shí)現(xiàn)上傳圖片并顯示圖片名稱
- 01-10Vue中使用Lodop插件實(shí)現(xiàn)打印功能的簡(jiǎn)單方法
- 01-10echarts實(shí)現(xiàn)折線圖的拖拽效果
- 01-10d3.js實(shí)現(xiàn)圖形縮放平移
- 01-10小程序簡(jiǎn)單兩欄瀑布流效果的實(shí)現(xiàn)
- 01-10H5實(shí)現(xiàn)手機(jī)拍照和選擇上傳功能
- 01-10Echarts實(shí)現(xiàn)多條折線可拖拽效果


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問(wèn)題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 04-02javascript點(diǎn)線,點(diǎn)線的代碼
- 04-02javascript潛力,javascript強(qiáng)大嗎
- 04-02javascript替換字符串,js字符串的替換
- 04-02javascript移出,js 移入移出
- 04-02包含javascript舍的詞條
- 04-02javascript并行,深入理解并行編程 豆瓣
- 04-02javascript匿名,js匿名方法
- 04-02javascript警報(bào),JavaScript警告
- 04-02javascript遮蓋,JavaScript遮蓋PC端頁(yè)面
- 04-02javascript前身,javascript的前身
隨機(jī)閱讀
- 04-02jquery與jsp,用jquery
- 01-10delphi制作wav文件的方法
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 01-10C#中split用法實(shí)例總結(jié)
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?


