哈尔滨列举网 > 教育培训 > 电脑/网络 > 爱尚实训教你自己编在线电影票选座功能程序
哈尔滨
[切换城市]

爱尚实训教你自己编在线电影票选座功能程序

更新时间:2018-07-29 16:33:27 浏览次数:30次
区域: 哈尔滨 > 南岗 > 和兴
类别:软件工程师培训
地址:南岗区和兴三道街214号13层
近大家都在谈论一部热播的电影《我不是药神》,由于故事贴近生活,贴近到每个人都能切身体会到演员的情绪,因为感同身受,所以就更能够引起共鸣。影片在批判社会现实、揭露尖锐矛盾,反映社会底层人民得不到满足而不顾法律正义的同时,又给人们看到改变社会现实的希望与。
于是纷纷涌入影院,希望一起探讨这个话题。于是,美团影院、Q Q购票,猫眼购票等等成是我们购票的。

网上购票如此的方便,那么我们能用HTML5+JavaScript实现一款在线电影票的选票功能吗?

答案是肯定的,今天我们就来借助jQuery的jQuery-Seat-Charts插件来实现在线电影票选座功能。

本案例(科文中心电影院)支持在线选座,票数统计,结算等功能。

图片描述(多50字)
根据上面的实例,我相信你们可以制作一款针对12306的在线选火车票的效果,汽车票也一样。

下面看看具体的实现代码:

<div class="demo">

  <div id="seat-map">

  <div class="front">屏幕</div>      

</div>

<div class="booking-details">

  <p>影片:<span>星际穿越3D</span></p>

  <p>时间:<span>11月14日 21:00</span></p>

  <p>座位:</p>

  <ul id="selected-seats"></ul>

  <p>票数:<span id="counter">0</span></p>

  <p>总计:<b>¥<span id="total">0</span></b></p>  

  <button class="checkout-button">确定购买</button>  

  <div id="legend"></div>

</div>

</div>

剩下的主要的是使用CSS将页面中的各个元素美化。

包括电影院布局,座位布局,选票功能实现,实时统计票数等功能。

.front{width: 300px;margin: 5px 32px 45px 32px;background-color: #f0f0f0; color: #666;text-align: center;padding: 3px;border-radius: 5px;}

.booking-details {float: right;position: relative;width:200px;height: 450px; }

.booking-details h3 {margin: 5px 5px 0 0;font-size: 16px;}

.booking-details p{line-height:26px; font-size:16px; color:#999}

.booking-details p span{color:#666}

div.seatCharts-cell {color: #182C4E;height: 25px;width: 25px;line-height: 25px;margin: 3px;float: left;text-align: center;outline: none;font-size: 13px;}

div.seatCharts-seat {color: #fff;cursor: pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius: 5px;}

div.seatCharts-row {height: 35px;}

div.seatCharts-seat.available {background-color: #B9DEA0;}

div.seatCharts-seat.focused {background-color: #76B474;border: none;}

div.seatCharts-seat.selected {background-color: #E6CAC4;}

div.seatCharts-seat.unavailable {background-color: #472B34;cursor: not-allowed;}

div.seatCharts-container {border-right: 1px dotted #adadad;width: 400px;padding: 20px;float: left;}

div.seatCharts-legend {padding-left: 0px;position: absolute;bottom: 16px;}

ul.seatCharts-legendList {padding-left: 0px;}

.seatCharts-legendItem{float:left; width:90px;margin-top: 10px;line-height: 2;}

span.seatCharts-legendDescription {margin-left: 5px;line-height: 30px;}

.checkout-button {display: block;width:80px; height:24px; line-height:20px;margin: 10px auto;border:1px solid #999;font-size: 14px; cursor:pointer}

#selected-seats {max-height: 150px;overflow-y: auto;overflow-x: none;width: 200px;}

#selected-seats li{float:left; width:72px; height:26px; line-height:26px; border:1px solid #d3d3d3; background:#f7f7f7; margin:6px; font-size:14px; font-weight:bold; text-align:center}

后引入我们的jQuery的jQuery-Seat-Charts插件

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

<script type="text/javascript" src="jquery.seat-charts.min.js"></script>

在调用该插件的seatCharts()方法即可实现电影票选票功能的渲染。

$('#seat-map').seatCharts()

以上就是大致的电影院选票功能的实现。

如果觉得还不过瘾,不妨可以关注一下微信49 15 24 96,还有更多精彩案例
哈尔滨电脑/网络相关信息
2022-09-19
2021-08-30
2021-08-27
2021-08-26
2021-08-25
2021-08-24
2021-08-23
2021-08-20
注册时间:2017年07月13日
UID:408604
---------- 认证信息 ----------

查看用户主页