JS+CSS实现仿触屏手机拨号盘界面及功能模拟完整实例

本文实例讲述了JS+CSS实现仿触屏手机拨号盘界面及功能模拟的方法。分享给大家供大家参考。具体如下:

首先来看一下运行效果图:

具体实现代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>仿安卓手机拨号界面按键特效</title>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
/* Current Tab */
$('.phone-tabs li a').click(function() {
$('.phone-tabs li').removeClass('current');
$(this).parent().addClass('current');
});
/* Simple Tab */
var tabContents = $('.phone-tab-contents');
$('.phone-tabs .getphone').click(function() {
tabContents.removeClass('getpeoples');
tabContents.removeClass('getclock');
});
$('.phone-tabs .getclock').click(function() {
tabContents.removeClass('getpeoples');
tabContents.addClass('getclock');
});
$('.phone-tabs .getpeoples').click(function() {
tabContents.removeClass('getclock');
tabContents.addClass('getpeoples');
});
/* Delete */
$('.delete-btn').click(function() {
var numbers = $('.number-area .numbers').text();
var numbers2 = $('.number-area .numbers').text().length;
$('.number-area .numbers').text(numbers.substr(0, numbers2 - 1));
});
/* Pusher */
var pusher = {
number: function(num) {
$('.numbers-container .pushed' + num + '').click(function() {
$('.number-area .numbers').append('' + num + '');
});
}
}
pusher.number(1);
pusher.number(2);
pusher.number(3);
pusher.number(4);
pusher.number(5);
pusher.number(6);
pusher.number(7);
pusher.number(8);
pusher.number(9);
pusher.number(0);
$('.numbers-container .pushedasterisk').click(function() {
$('.number-area .numbers').append('*');
});
$('.numbers-container .pushednumber').click(function() {
$('.number-area .numbers').append('#');
});
});
</script>
<style>
*{
margin:0;
padding:0;
}
::selection{
background:transparent;
}
body{
color:#4196b7;
font:normal 12px arial,sans-serif;
}
.nexus{
position:relative;
margin:10px auto;
width:314px;
height:600px;
border-radius:80px / 40px;
border-top:3px solid #222;
background:#6d6d6b;
background:-moz-linear-gradient(left, #6d6d6b 0%, #3b3b3c 1%, #979797 3%, #686868 4%, #2e2e2e 100%);
background:-webkit-gradient(linear, left top, right top, color-stop(0%,#6d6d6b), color-stop(1%,#3b3b3c), color-stop
(3%,#979797), color-stop(4%,#686868), color-stop(100%,#2e2e2e));
background:-webkit-linear-gradient(left, #6d6d6b 0%,#3b3b3c 1%,#979797 3%,#686868 4%,#2e2e2e 100%);
background:-o-linear-gradient(left, #6d6d6b 0%,#3b3b3c 1%,#979797 3%,#686868 4%,#2e2e2e 100%);
background:-ms-linear-gradient(left, #6d6d6b 0%,#3b3b3c 1%,#979797 3%,#686868 4%,#2e2e2e 100%);
background:linear-gradient(to right, #6d6d6b 0%,#3b3b3c 1%,#979797 3%,#686868 4%,#2e2e2e 100%);
filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#6d6d6b', endColorstr='#2e2e2e',GradientType=1 );
}
.nexus:before{
position:absolute;
content:'';
z-index:-1;
top:-6px;
left:0px;
background:#babbbb;
width:314px;
height:78px;
border-radius:25% / 45%;
border-top:1px solid #444;
}
.nexus:after{
position:absolute;
content:'';
z-index:-1;
bottom:-5px;
left:0px;
background:#babbbb;
width:314px;
height:78px;
border-radius:25% / 45%;
border-bottom:2px solid #555;
}
.speaker{
position:absolute;
left:0px;
top:0px;
width:65px;
height:5px;
background:#333;
left:50%;
margin-left:-33px;
border-radius:0 0 6px 6px;
border:1px solid #474747;
border-top:0;
box-shadow:inset 0 0 1px black;
}
.screen{
position:absolute;
left:17px;
top:64px;
width:282px;
height:467px;
background:white;
}
.phone-infos{
width:100%;
height:17px;
background:#303030;
}
.phone-infos span{
float:right;
font-size:11px;
margin:2px 3px;
}
.phone-infos .battery{
width:8px;
height:10px;
background:#4196b7;
margin-top:2px;
position:relative;
margin-top:4px;
}
.phone-infos .battery:before{
width:4px;
height:2px;
position:absolute;
left:2px;
top:-2px;
background:#4196b7;
content:'';
}
.phone-infos .gsm{
position:relative;
height:12px;
margin-right:10px;
}
.phone-infos .gsm b{
float:left;
position:absolute;
bottom:0;
}
.phone-infos .gsm b:before{
position:absolute;
content:'';
top:-3px;
width:0;
height:0;
border-bottom:3px solid #4196b7;
border-left:3px solid transparent;
}
.phone-infos .gsm .signal1{
width:3px;
height:0px;
background:#4196b7;
left:-8px;
}
.phone-infos .gsm .signal2{
width:3px;
height:3px;
background:#4196b7;
left:-4px;
}
.phone-infos .gsm .signal3{
width:3px;
height:7px;
background:#4196b7;
}
.phone-infos .gsm .signal4{
width:3px;
height:11px;
background:#808184;
left:4px;
}
.phone-infos .gsm .signal4:before{
border-bottom:3px solid #808184;
border-left:3px solid transparent;
}
.phone-tabs{
border-bottom:1px solid #858383;
background:#303030;
height:50px;
}
.phone-tabs li{
float:left;
list-style:none;
-webkit-transition:all .05s ease-in;
-moz-transition:all .05s ease-in;
-o-transition:all .05s ease-in;
transition:all .05s ease-in;
}
.phone-tabs li a{
-webkit-transition:all .05s ease-in;
-moz-transition:all .05s ease-in;
-o-transition:all .05s ease-in;
transition:all .05s ease-in;
text-decoration:none;
background:#303030;
cursor:pointer;
height:40px;
width:94px;
display:block;
text-align:center;
position:relative;
padding-top:10px;
}
.phone-tabs li a:active{
background:rgba(104,208,249,.4);
}
.phone-tabs li a:before{
height:20px;
width:1px;
background:#858383;
position:absolute;
content:'';
left:0;
top:16px;
}
.phone-tabs li:first-child a:before{
display:none;
}
.phone-tabs li.current a:after{
position:absolute;
content:'';
left:0px;
bottom:0px;
width:100%;
height:5px;
background:#4196b7;
}
.phone-tab-contents{
width:100%;
height:365px;
position:relative;
overflow:hidden;
}
.phone-tab-contents .tab{
width:100%;
height:365px;
position:absolute;
background:#3f3f3f;
position:absolute;
-webkit-transition:all .25s ease-in;
-moz-transition:all .25s ease-in;
-o-transition:all .25s ease-in;
transition:all .25s ease-in;
}
.phone-tab-contents .tab.phone{
left:0;
background:#3f3f3f url(data:image/png;
base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAKElEQVQIW2NkQAOO07anMSKLgQT2Z3nOggvCBECKwILIAmBBdAGQIABJuxH63EphJgAAAAB
JRU5ErkJggg==) repeat;
}
.phone-tab-contents .tab.clock{
left:282px;
}
.phone-tab-contents .tab.peoples{
left:564px;
}
.phone-tab-contents.getclock .tab.phone{
left:-282px;
}
.phone-tab-contents.getclock .tab.clock{
left:0px;
}
.phone-tab-contents.getclock .tab.peoples{
left:282px;
}
.phone-tab-contents.getpeoples .tab.phone{
left:-564px;
}
.phone-tab-contents.getpeoples .tab.clock{
left:-282px;
}
.phone-tab-contents.getpeoples .tab.peoples{
left:0px;
}
.phone-tab-contents .tab.clock p:first-child,
.phone-tab-contents .tab.peoples p:first-child{
margin-top:50px;
}
.phone-tab-contents .tab.peoples p,
.phone-tab-contents .tab.clock p{
width:90%;
padding:10px 5% 0;
text-align:center;
color:#bbb;
}
.phone-tab-contents .tab.peoples p a,
.phone-tab-contents .tab.clock p a{
color:#fff;
}
.main-btns{
width:100%;
height:34px;
background:#303030;
}
.main-btns li{
list-style:none;
float:left;
}
.main-btns li a{
width:30px;
display:block;
width:94px;
height:34px;
text-align:center;
}
.number-area{
color:#fff;
font-size:20px;
text-align:center;
padding:20px 0 20px;
width:100%;
overflow:hidden;
border-bottom:1px solid #333;
margin-bottom:10px;
}
.number-area .numbers{
width:230px;
float:left;
padding:0 10px;
height:14px;
}
.number-area .delete-btn{
float:right;
margin-right:10px;
cursor:pointer;
}
.numbers-container{
overflow:hidden;
}
.numbers-container span{
width:94px;
height:30px;
float:left;
font-size:30px;
text-indent:22px;
position:relative;
padding:15px 0;
cursor:pointer;
}
.numbers-container span:active{
background:rgba(104,208,249,.4);
}
.numbers-container span em{
font-size:12px;
color:#fff;
font-style:normal;
position:absolute;
left:22px;
bottom:15px;
padding-bottom:5px;
}
.numbers-container span em.brd:before{
position:absolute;
width:14px;
height:2px;
background:#fff;
content:'';
top:9px;
left:24px;
}
.numbers-container span em:after{
width:35px;
height:2px;
background:#4196b7;
content:'';
position:absolute;
top:16px;
left:22px;
}
.numbers-container span.fff{
color:#fff;
text-align:center;
}
.call-btn{
width:100%;
text-align:center;
border-top:1px solid #333;
padding-top:10px;
}
/* Icon Group */
.icon{
display:inline-block;
font-style:normal;
position:relative;
}
.icon.phone{
background:#fff;
width:5px;
height:26px;
-webkit-transform:rotate(145deg);
-moz-transform:rotate(145deg);
-o-transform:rotate(145deg);
transform:rotate(145deg);
border-radius:0 6px 6px 0;
margin-top:5px;
}
.icon.phone:before{
position:absolute;
content:'';
width:8px;
height:9px;
background:#fff;
left:-6px;
bottom:-1px;
border-radius:3px 6px 7px 3px;
}
.icon.phone:after{
position:absolute;
content:'';
width:8px;
height:9px;
background:#fff;
left:-6px;
top:-1px;
border-radius:3px 6px 7px 3px;
}
.icon.clock{
background:#303030;
width:22px;
height:22px;
border:2px solid #fff;
border-radius:22px;
margin-top:4px;
}
.icon.clock:before{
position:absolute;
content:'';
height:9px;
width:2px;
background:#fff;
top:2px;
left:10px;
}
.icon.clock:after{
position:absolute;
content:'';
height:9px;
width:2px;
background:#fff;
top:9px;
-webkit-transform:rotate(120deg);
-o-transform:rotate(120deg);
-moz-transform:rotate(120deg);
transform:rotate(120deg);
left:14px;
}
.icon.peoples{
background:#fff;
height:10px;
width:22px;
border-radius:12px 12px 0 0;
margin-top:20px;
}
.icon.peoples:after{
position:absolute;
content:'';
background:#fff;
width:14px;
height:14px;
border:2px solid #303030;
border-radius:18px;
top:-14px;
left:2px;
z-index:10;
}
.icon.peoples:before{
position:absolute;
content:'';
background:#303030;
width:10px;
height:5px;
left:6px;
top:-5px;
z-index:20;
border-radius:0 0 15px 15px;
}
.icon.close{
font-size:12px;
color:#303030;
background:#fff;
width:14px;
height:12px;
line-height:12px;
margin-top:5px;
}
.icon.close:before{
position:absolute;
content:'';
left:-8px;
width:0px;
height:0px;
border-style:solid;
border-width:6.5px 8px 6.5px 0;
border-color:transparent #ffffff transparent transparent;
}
.icon.home{
width:25px;
height:8px;
border:2px solid #bbbbbb;
border-top:0;
margin-top:15px;
}
.icon.home:after{
width:2px;
height:17px;
background:#bbbbbb;
position:absolute;
top:-12px;
left:5px;
content:'';
-webkit-transform:rotate(70deg);
-moz-transform:rotate(70deg);
-o-transform:rotate(70deg);
transform:rotate(70deg);
}
.icon.home:before{
width:2px;
height:17px;
background:#bbbbbb;
position:absolute;
top:-12px;
right:5px;
content:'';
-webkit-transform:rotate(110deg);
-moz-transform:rotate(110deg);
-o-transform:rotate(110deg);
transform:rotate(110deg);
}
.icon.windows{
width:20px;
height:8px;
border:2px solid #bbbbbb;
margin-top:13px;
}
.icon.windows:after{
width:2px;
height:14px;
background:#bbbbbb;
position:absolute;
content:'';
right:-6px;
top:-6px;
}
.icon.windows:before{
width:22px;
height:2px;
background:#bbbbbb;
position:absolute;
content:'';
right:-4px;
top:-6px;
}
.icon.back{
width:20px;
height:2px;
background:#bbb;
color:#bbb;
font-size:18px;
line-height:0px;
text-indent:-16px;
font-family:sans-serif;
margin-top:12px;
}
.icon.back:before{
width:7px;
height:11px;
background:#303030;
position:absolute;
content:'';
left:8px;
z-index:10;
top:2px;
}
.icon.back:after{
width:20px;
height:7px;
border:2px solid #bbb;
position:absolute;
content:'';
border-radius:10px;
}
</style>
</head>
<body>
<div class="nexus">
<div class="speaker"></div>
<div class="screen">
<div class="phone-infos">
<span>03.15</span>
<span class="battery"></span>
<span class="gsm">
<b class="signal1"></b>
<b class="signal2"></b>
<b class="signal3"></b>
<b class="signal4"></b>
</span>
</div>
<ul class="phone-tabs">
<li class="current"><a class="getphone"><i class="icon phone"></i></a></li>
<li><a class="getclock"><i class="icon clock"></i></a></li>
<li><a class="getpeoples"><i class="icon peoples"></i></a></li>
</ul>
<div class="phone-tab-contents">
<div class="tab phone current">
<div class="number-area">
<span class="numbers"></span>
<a class="delete-btn"><i class="icon close">x</i></a>
</div>
<div class="numbers-container">
<span class="pushed1">1<em class="brd">o o</em></span>
<span class="pushed2">2<em>ABC</em></span>
<span class="pushed3">3<em>DEF</em></span>
<span class="pushed4">4<em>GHI</em></span>
<span class="pushed5">5<em>JKL</em></span>
<span class="pushed6">6<em>MNO</em></span>
<span class="pushed7">7<em>PQRS</em></span>
<span class="pushed8">8<em>TUV</em></span>
<span class="pushed9">9<em>WXYZ</em></span>
<span class="pushedasterisk fff">*</span>
<span class="pushed0">0<em>+</em></span>
<span class="pushednumber fff">#</span>
</div>
<div class="call-btn">
<i class="icon phone"></i>
</div>
</div>
<div class="tab clock">
<p>Not Ready</p>
<p>Visit Nexus 4 Official Page</p>
<p><a href="/">/</a></p>
<p>Visit My Site</p>
<p><a href="/">/</a></p>
</div>
<div class="tab peoples">
<p>Not Ready</p>
<p>Visit Nexus 4 Official Page</p>
<p><a href="/">/</a></p>
<p>Visit My Site</p>
<p><a href="/">/</a></p>
</div>
</div>
<ul class="main-btns">
<li><a><i class="icon back"><</i></a></li>
<li><a><i class="icon home"></i></a></li>
<li><a><i class="icon windows"></i></a></li>
</ul>
</div>
</div>
<div style="text-align:center;clear:both;">
</div>
</body>
</html>

希望本文所述对大家的jQuery程序设计有所帮助。

(0)

相关推荐

  • 触屏中的JavaScript事件分析

    本文实例讲述了触屏中的JavaScript事件.分享给大家供大家参考.具体分析如下: 一.触摸事件 ontouchstart ontouchmove ontouchend ontouchcancel目前移动端浏览器均支持这4个触摸事件,包括IE.由于触屏也支持MouseEvent,因此他们的顺序是需要注意的:touchstart → mouseover → mousemove → mousedown → mouseup → click1 实例如下: /** * onTouchEvent */ v

  • js 表格排序(编辑+拖拽+缩放)

    Table body{ font-size:12px} #tab{ border-collapse: collapse;} .edit{ height:16px; width:98%; background-color:#EFF7FF; font-size:12px; border:0px;} #tab thead td{ background:url(/upload/201005/20100531233452190.bmp);color:#183C94} #tab tbody td{ over

  • js完美的div拖拽实例代码

    复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="

  • javascript实现移动端上的触屏拖拽功能

    本文是分享了javascript实现移动端上的触屏拖拽功能,具体内容如下 效果图: 实现代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <meta name="viewport" content="width=device-width, user-scalable=no, initi

  • js实现touch移动触屏滑动事件

    移动端触屏滑动的效果其实就是图片轮播,在PC的页面上很好实现,绑定click和mouseover等事件来完成.但是在移动设备上,要实现这种轮播的效果,就需要用到核心的touch事件.处理touch事件能跟踪到屏幕滑动的每根手指. 以下是四种touch事件 touchstart: //手指放到屏幕上时触发 touchmove: //手指在屏幕上滑动式触发 touchend: //手指离开屏幕时触发 touchcancel: //系统取消touch事件的时候触发,这个好像比较少用 每个触摸事件被触发

  • js最简单的拖拽效果实现代码

    其实对于弹出层而言,拖拽最初的目的很单纯,就是为了通过拉开层,使被弹出层挡住的内容可见,(当然,后来关于拖拽的功能不断被优化,使得拖拽的应用有了别的意义,最典型的如igoogle的自定义首页,通过拖放的形式满足用户自定义想要的内容模块顺序和位置). 本文讨论的重点不是iGoogle的拖放效果,那属于进阶篇,本文是拖拽的"第一阶",如题,实现最简单的拖拽. 这里的"最简单"即不考虑多个拖拽层的堆叠顺序,不考虑拖拽范围限制,不考虑类似iGoogle的"drag

  • javascript拖拽上传类库DropzoneJS使用方法

    用法 1. add js and css style 复制代码 代码如下: <link href="~/Dropzone/css/basic.css" rel="stylesheet" /> <link href="~/Dropzone/css/dropzone.css" rel="stylesheet" /> <script src="~/Dropzone/dropzone.min.j

  • 基于JavaScript实现移动端TAB触屏切换效果

    展示效果图如下所示: 效果演示 源码下载 我们使用移动端时可以通过触屏手势左右滑动来切换TAB栏目,如网易新闻等APP栏目切换.我们说的TAB一般由导航条和TAB对应的内容组成,切换导航条上的标签同时标签对应的内容也会跟着切换.本文将结合实例给大家介绍一个移动端TAB触屏切换效果. HTML 我们准备一个TAB导航#pagenavi,里面包含TAB导航要切换的四个导航按钮,然后是切换的主体内容#slider,这里应该放置四个li与导航按钮对应,内容自定义. <div class="box-

  • js实现滑动触屏事件监听的方法

    本文实例讲述了js实现滑动触屏事件监听的方法.分享给大家供大家参考.具体实现方法如下: function span_move_fun(){ var span = document.getElementById("move_k"); var span_left = $(span).offset().left; var span_top = $(span).offset().top; var start_left = $(span).offset().left; var start_top

  • JS+CSS实现仿触屏手机拨号盘界面及功能模拟完整实例

    本文实例讲述了JS+CSS实现仿触屏手机拨号盘界面及功能模拟的方法.分享给大家供大家参考.具体如下: 首先来看一下运行效果图: 具体实现代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w

  • JS实现移动端触屏拖拽功能

    1.html <div id="div1"></div> 2.css * { margin: 0; padding: 0; } html, body { width: 100%; height: 100%; } #div1 { width: 50px; height: 50px; background: cyan; position: absolute; } 3.js var div1 = document.querySelector('#div1'); //限

  • JS+CSS实现仿支付宝菜单选中效果代码

    本文实例讲述了JS+CSS实现仿支付宝菜单选中效果代码.分享给大家供大家参考.具体如下: 这是一个漂亮的JS+CSS仿支付宝菜单,总体风格和形式与支付宝的菜单没什么两样,细心会发现这是一个CSS爱好者自己手功完成的,自己美化图片,重写CSS代码,为作者给我们奉献这么好的菜单而表示感谢. 运行效果截图如下: 在线演示地址如下: http://demo.jb51.net/js/2015/js-css-f-alipay-style-menu-codes/ 具体代码如下: <!DOCTYPE html

  • JS+CSS实现仿msn风格选项卡效果代码

    本文实例讲述了JS+CSS实现仿msn风格选项卡效果代码.分享给大家供大家参考,具体如下: 这是一款来自MSN网站的选项卡,清新淡蓝色风格,新闻类.资讯类.文章类网站都比较适合使用,代码扩展性高,W3C标准设计,兼容IE.火狐等多种浏览器,整体效果非常不错. 运行效果截图如下: 在线演示地址如下: http://demo.jb51.net/js/2015/js-css-f-msn-style-menu-demo/ 具体代码如下: <!DOCTYPE html PUBLIC "-//W3C/

  • JS+CSS实现仿雅虎另类滑动门切换效果

    本文实例讲述了JS+CSS实现仿雅虎另类滑动门切换效果.分享给大家供大家参考.具体如下: 这是仿照雅虎特色服务的一个Tab滑动切换效果,核心是一个CSS滑动门,经过了改进,有点特别,看下效果吧,估计很多朋友会喜欢的. 运行效果截图如下: 在线演示地址如下: http://demo.jb51.net/js/2015/js-css-f-yahoo-hdm-menu-demo/ 具体代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transi

  • JS+CSS实现仿新浪微博搜索框的方法

    本文实例讲述了JS+CSS实现仿新浪微博搜索框的方法.分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtm

  • 纯js+css实现仿移动端淘宝网站的弹出详情框功能

    点击查看图片 代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="ap

  • js实现百度联盟中一款不错的图片切换效果完整实例

    本文实例讲述了js实现百度联盟中一款不错的图片切换效果的方法.分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: <html> <title>js实现百度联盟中的一个不错的图片切换效果</title> <body> <script> var links = new Array(); links[1] = "http://www.baidu.com/"; links[2] = "http://www.jb5

  • JS模仿腾讯图片站的图片翻页按钮效果完整实例

    本文实例讲述了JS模仿腾讯图片站的图片翻页按钮效果.分享给大家供大家参考,具体如下: 运行效果截图如下: 具体代码如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" conten

随机推荐