flex布局构建大屏框架并支持翻页动画、滚动表格功能

 

本文将利用flex属性构建大屏可视化界面。界面主要分标题栏、工具栏、数据可视化窗口。其中,翻页动画以及滚动表格功能分别分布在数据可视化界面两侧。

 鼠标点击标题,可看到左侧窗口翻转动画;

整体布局效果图:

 

 

滚动列表效果图及核心代码:

 

 var myH = $(".tableBoy").height() + 10;//获取容器高度 确定可视区域
        $(".tableBoy").css({ 'height': myH + "px", "overflow-y": "hidden" });
        $('.tableB').clone().appendTo(".tableBoy");//拷贝数据
        //设置动画
        setInterval(function() {
            $(".tableB").animate({ top: -myH + 'px' }, 3000);
            $(".tableB").animate({ top: '0px' }, 0);
        });

  

源代码:

  1 <!DOCTYPE html>
  2 <html lang="en">
  3 
  4 <head>
  5     <meta charset="utf-8">
  6     <title>
  7         大屏展示ppt_40
  8     </title>
  9     </meta>
 10 </head>
 11 
 12 <body>
 13     <style>
 14     /* #A {
 15         height: 100px;
 16         width: 200px;
 17         background: yellow;
 18         border-radius: 50%;
 19         transform: rotate(30deg);
 20         Rotate div
 21         transform: rotate(30deg);
 22         -ms-transform: rotate(30deg);
 23         IE 9
 24         -webkit-transform: rotate(30deg);
 25         Safari and Chrome
 26     }
 27     
 28     #B {
 29         margin-top: 300px;
 30         height: 100px;
 31         width: 200px;
 32         transform: scale(2, 3);
 33         -ms-transform: scale(2, 3);
 34         -webkit-transform: scale(2, 3);
 35         background: blue;
 36     
 37     }
 38     
 39     .red {
 40         color: red;
 41     }
 42     
 43     .green {
 44         color: green;
 45     }
 46      */
 47     html,
 48     body {
 49         height: 100%;
 50     }
 51 
 52     body {
 53         margin: 0px;
 54         background: url(bigDataBackground.jpg) 100% 100%;
 55     }
 56 
 57     /*  版心 */
 58     .my-container {
 59         width: 96%;
 60         height: 100%;
 61         margin: 0px auto;
 62         /*  background-color: #eee; */
 63         color: #fff;
 64         /* display: flex;*/
 65     }
 66 
 67     .my-container>div {
 68         width: 100%;
 69     }
 70 
 71     /* 抬头 */
 72     .my-heart {
 73         font-weight: 700;
 74         font-size: 24px;
 75         line-height: 24px;
 76         background-color: #46487542;
 77         height: 50px;
 78         z-index: 999999;
 79         /* text-align: center; */
 80         display: flex;
 81         justify-content: center;
 82         /* 水平居中 */
 83         align-items: center;
 84         /* 竖直居中 */
 85     }
 86 
 87     /* 工具栏 */
 88     .tool {
 89         height: 70px;
 90         display: flex;
 91         justify-content: center;
 92         /* 水平居中 */
 93         align-items: center;
 94         /* 竖直居中 */
 95     }
 96 
 97     .tool>div {
 98         height: 40px;
 99         width: 100%;
100         display: flex;
101         padding: 0 0 0 100px;
102         justify-content: flex-start;
103         position: relative;
104     }
105 
106     /* 工具栏容器 */
107     .tool-con {
108         width: 100%;
109         margin-left: 52px;
110         padding: 5px;
111     }
112 
113     /* 展示容器 */
114     .showCon {
115         display: flex;
116         justify-content: flex-start;
117         /* justify-content: center;水平居中 */
118         align-items: center;
119         /* 竖直居中 */
120 
121         height: inherit;
122         margin-top: -132px;
123         padding-top: 130px;
124         padding-bottom: 28px;
125         box-sizing: border-box;
126         position: inherit;
127         top: 0px;
128 
129     }
130 
131     .showCon>div {
132         height: 100%;
133         background: #1000ff14;
134         position: relative;
135         padding: 4px 8px;
136         box-sizing: border-box;
137         border: 1px solid #300046;
138     }
139 
140     .showLeft {
141         flex: 1;
142         position: relative;
143     }
144 
145     .showCen {
146         flex: 2;
147         margin: 0 10px;
148         position: relative;
149         display: flex;
150     }
151 
152     .showRig {
153         flex: 1;
154         position: relative;
155     }
156 
157     .yuan {
158         width: 50px;
159         height: 50px;
160         top: -5px;
161         position: absolute;
162         justify-content: center;
163         /* 水平居中 */
164         align-items: center;
165         /* 竖直居中 */
166     }
167 
168 
169 
170     /* 实线圆圈 */
171     .cril_s {
172         border: 1px solid;
173         border-radius: 50%;
174         text-align: center;
175     }
176 
177     /* 虚线圆圈 */
178     .cril_x {
179         border: 1px dashed;
180         border-radius: 50%;
181         padding: 5px;
182         box-sizing: border-box;
183     }
184 
185     /* 闪光 */
186     .buling {
187         box-shadow: 0 0 10px #6360fb9c;
188         z-index: -1;
189     }
190 
191     .tableBoy {}
192 
193     .tableT,
194     .tableH,
195     .tableB {
196         display: flex;
197         padding: 5px 10px;
198         justify-content: flex-start;
199         position: relative;
200         margin-top: 10px;
201         border-radius: 4px;
202     }
203 
204     .tableT {
205         font-weight: 700;
206         text-shadow: 1px 1px 6px #ff3b00;
207         /* 文字闪光 */
208     }
209 
210     .tableB {
211         background: #63300521;
212         margin-left: 14px;
213     }
214 
215     .tableB::before {
216         content: attr(data-attr);
217         width: 24px;
218         height: 24px;
219         position: absolute;
220         border: 1px solid yellow;
221         background: #f9fd0224;
222         left: -12px;
223         top: 7px;
224         color: aqua;
225         transform: rotate(35deg);
226         /* padding: 0 5px; */
227         text-align: center;
228         font-weight: 700;
229         box-sizing: border-box;
230     }
231 
232     .tableH {
233         background: #c1671b21;
234     }
235 
236     .tableB>div,
237     .tableH>div {
238         display: flex;
239         justify-content: center;
240         flex: 1;
241     }
242 
243     .tableL {
244         align-items: center;
245     }
246 
247     .l1,
248     .l2 {
249         height: 50%;
250         background: #f0f4ff0a;
251         position: relative;
252     }
253 
254     .l2 {
255         margin: 5px 0;
256     }
257 
258     /* 角装饰 */
259     .showCen:before,
260     .showRig:before,
261     .showLeft:before {
262         content: '';
263         height: 6px;
264         width: 6px;
265         border-left: 2px solid #4b6ee2;
266         border-top: 2px solid #4b6ee2;
267         position: absolute;
268         top: -1px;
269         left: -1px;
270         z-index: 2;
271 
272     }
273 
274     .showCen:after,
275     .showRig:after,
276     .showLeft:after {
277         content: '';
278         height: 6px;
279         width: 6px;
280         border-right: 2px solid #4b6ee2;
281         border-bottom: 2px solid #4b6ee2;
282         position: absolute;
283         right: -1px;
284         bottom: -1px;
285         z-index: 2;
286 
287     }
288 
289     .tableB .tableR {
290         font-size: 23px;
291         color: aqua;
292         font-family: fantasy;
293     }
294 
295 
296 
297     /* 正八边形 */
298     #octagon {
299         width: 100px;
300         height: 100px;
301         background: #6376ff1f;
302         position: relative;
303     }
304 
305     #octagon:before {
306         content: "";
307         width: 50px;
308         height: 0;
309         position: absolute;
310         top: 0;
311         left: 0;
312         border-bottom: 25px solid #6376ff1f;
313         border-left: 25px solid white;
314         border-right: 25px solid white;
315     }
316 
317     #octagon:after {
318         content: "";
319         width: 50px;
320         height: 0;
321         position: absolute;
322         bottom: 0;
323         left: 0;
324         border-top: 25px solid #6376ff1f;
325         border-left: 25px solid white;
326         border-right: 25px solid white;
327     }
328 
329     /* 八角星 */
330     #burst-8 {
331         background: #6376ff1f;
332         width: 80px;
333         height: 80px;
334         position: relative;
335         text-align: center;
336         transform: rotate(20deg);
337     }
338 
339     #burst-8:before {
340         content: "";
341         position: absolute;
342         top: 0;
343         left: 0;
344         height: 80px;
345         width: 80px;
346         background: #6376ff1f;
347         transform: rotate(135deg);
348     }
349 
350     /* 正六边形 */
351     #hexagon {
352         width: 100px;
353         height: 55px;
354         background: #6376ff1f;
355         position: relative;
356         top: 25px;
357     }
358 
359     #hexagon:before {
360         content: "";
361         position: absolute;
362         top: -25px;
363         left: 0;
364         width: 0;
365         height: 0;
366         border-left: 50px solid transparent;
367         border-right: 50px solid transparent;
368         border-bottom: 25px solid #6376ff1f;
369     }
370 
371     #hexagon:after {
372         content: "";
373         position: absolute;
374         bottom: -25px;
375         left: 0;
376         width: 0;
377         height: 0;
378         border-left: 50px solid transparent;
379         border-right: 50px solid transparent;
380         border-top: 25px solid #6376ff1f;
381     }
382 
383     /* 六角星 */
384     #star-six {
385         width: 0;
386         height: 0;
387         border-left: 50px solid transparent;
388         border-right: 50px solid transparent;
389         border-bottom: 100px solid #6376ff1f;
390         position: relative;
391     }
392 
393     #star-six:after {
394         width: 0;
395         height: 0;
396         border-left: 50px solid transparent;
397         border-right: 50px solid transparent;
398         border-top: 100px solid #6376ff1f;
399         position: absolute;
400         content: "";
401         top: 30px;
402         left: -50px;
403     }
404 
405     /* 心形 */
406     #heart {
407         height: 50px;
408         width: 50px;
409         top: 20px;
410         background: #6376ff1f;
411         transform: rotate(45deg);
412         left: 20px;
413         position: absolute;
414     }
415 
416     #heart:before {
417         position: absolute;
418         content: "";
419         left: -25px;
420         top: 0px;
421         width: 50px;
422         height: 25px;
423         transform: rotate(-90deg);
424         background: #6376ff1f;
425         transform-origin: bottom;
426         border-radius: 50px 50px 0 0;
427     }
428 
429     #heart:after {
430         position: absolute;
431         content: "";
432         left: 0px;
433         top: -25px;
434         width: 50px;
435         height: 25px;
436         background: #6376ff1f;
437         border-radius: 50px 50px 0 0;
438     }
439 
440     /* 平行四边形 */
441     #ping {
442         height: 50px;
443         width: 100px;
444         transform: skew(20deg);
445         background: #6376ff1f;
446     }
447 
448     /* 椭圆 */
449     #tuoyuan {
450         height: 50px;
451         width: 100px;
452         border-radius: 50%;
453         background: #6376ff1f;
454     }
455 
456     /*伪元素是行内元素 正常浏览器清除浮动方法*/
457     .clearFix:after {
458         content: "";
459         display: block;
460         height: 0;
461         clear: both;
462         visibility: hidden;
463     }
464 
465     .sec:before {
466         content: attr(data-attr);
467         height: 24px;
468         color: brown;
469     }
470 
471     .sec_new:before {
472         content: attr(data-attr);
473         height: 24px;
474         color: red;
475     }
476 
477     .fanzhuan {
478         -webkit-animation: 1.5s fanzhuan ease-in-out backwards;
479         -moz-animation: 1.5s fanzhuan ease-in-out backwards;
480         animation: 1.5s fanzhuan ease-in-out backwards;
481     }
482 
483     @-webkit-keyframes fanzhuan {
484         0% {
485             -moz-transform: scale(0) rotateX(360deg);
486             -ms-transform: scale(0) rotateX(360deg);
487             -webkit-transform: scale(0) rotateX(360deg);
488             transform: scale(0) rotateX(360deg);
489             height: 150px;
490             width: 150px;
491         }
492 
493         50% {
494             -moz-transform: none;
495             -ms-transform: none;
496             -webkit-transform: none;
497             transform: none;
498             height: 150px;
499         }
500 
501         75% {
502             height: 350px;
503             width: 150px;
504         }
505 
506         100% {
507             width: 450px;
508         }
509     }
510 
511     @-moz-keyframes fanzhuan {
512         0% {
513             -moz-transform: scale(0) rotateX(360deg);
514             -ms-transform: scale(0) rotateX(360deg);
515             -webkit-transform: scale(0) rotateX(360deg);
516             transform: scale(0) rotateX(360deg);
517             height: 150px;
518             width: 150px;
519         }
520 
521         50% {
522             -moz-transform: none;
523             -ms-transform: none;
524             -webkit-transform: none;
525             transform: none;
526             height: 150px;
527         }
528 
529         75% {
530             height: 350px;
531             width: 150px;
532         }
533 
534         100% {
535             width: 450px;
536         }
537     }
538     </style>
539     <div class="my-container">
540         <div class="my-heart">
541             <span>城市区域信息展示</span>
542         </div>
543         <div class="tool">
544             <div>
545                 <div class="yuan cril_x buling">圆形</div>
546                 <div class="tool-con buling" style="box-shadow:0px 0 72px #3454dcba, 0 0 10px #504f7d9c, 0 0 10px #2c2a7545, 0 0 10px #1814de2b;">工具栏</div>
547             </div>
548         </div>
549         <div class="showCon">
550             <div class="showLeft">
551                 <div class="l1">左一</div>
552                 <div class="l2">左二</div>
553             </div>
554             <div class="showCen">
555                 中间区域
556                 <!-- <div id="burst-8"></div>
557                 <div id="octagon"></div>
558                 <div style="position: relative;width: 100px;">
559                     <div id="heart"></div>
560                 </div>
561                 <div id="star-six"></div>
562                 <div id="hexagon"></div>
563                 <div id="ping"></div>
564                 <div id="tuoyuan"></div> -->
565             </div>
566             <div class="showRig">
567                 <div class="tableT">
568                     <div class="yuan cril_s buling" style="width: 40px;height: 40px;">圆形</div>
569                     <div class="tool-con buling" style="margin-left: 45px;">子工具栏具栏</div>
570                 </div>
571                 <div class="tableH">
572                     <div class="tableL"><span>地区名</span></div>
573                     <div class="tableR"><span>得分</span></div>
574                 </div>
575                 <div class="tableBoy">
576                     <div class="tableB" data-attr='1'>
577                         <div class="tableL"><span>北京市</span></div>
578                         <div class="tableR"><span>95.2</span></div>
579                     </div>
580                     <div class="tableB" data-attr='2'>
581                         <div class="tableL"><span>武汉市</span></div>
582                         <div class="tableR"><span>88.7</span></div>
583                     </div>
584                 </div>
585             </div>
586         </div>
587     </div>
588     <script src="jquery-1.11.3.min.js"></script>
589     <script>
590     $(function() {
591 
592         /* 1. 翻页动画*/
593         $(".my-heart").on('click', function() {
594             $(".showLeft").removeClass('fanzhuan');
595             $(".showLeft").addClass('fanzhuan');
596         });
597 
598         /* 2. 拷贝数据
599         滚动列表*/
600         var myH = $(".tableBoy").height() + 10;//获取容器高度 确定可视区域
601         $(".tableBoy").css({ 'height': myH + "px", "overflow-y": "hidden" });
602         $('.tableB').clone().appendTo(".tableBoy");//拷贝数据
603         //设置动画
604         setInterval(function() {
605             $(".tableB").animate({ top: -myH + 'px' }, 3000);
606             $(".tableB").animate({ top: '0px' }, 0);
607         });
608 
609         
610 
611 
612     })
613     </script>
614 </body>
615 
616 </html>
这里是源码!!!

原文地址:https://www.cnblogs.com/giserjobs/p/12180892.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


一:display:flex布局display:flex是一种布局方式。它即可以应用于容器中,也可以应用于行内元素。是W3C提出的一种新的方案,可以简便、完整、响应式地实现各种页面布局。目前,它已经得到了所有浏览器的支持。Flex是FlexibleBox的缩写,意为"弹性布局",用来为盒状模型提供最大的灵
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何垂直居中对齐,方法有很多,但是在学习了flex布局之后,垂直居中更加容易实现HTML代码:1<divclass="demo">2<divclass="inner">3<p>这是一个测试这是一个测试这是一个测试这是一个测试这是一个测试</p>4</div
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些应用。常见的例子,比如360杀毒,photoShop,VisualStudioCode等等移动端app是什么,有哪些应用。常见的例子,比如手机微信,手机qq,手机浏览器,美颜相机等等PC端与移动端的区别第一:PC考虑的是浏览器的兼容性,移动端考
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周末了,难得学点东西,grid是之前看到的,很好奇,讲的二维的布局,看起来很方便,应该很适合移动端布局,所以今天抽时间学一学,这个当是笔记了。参考的是阮老师的博客。阮一峰:CSSGrid网格布局教程http://www.ruanyifeng.com/blog/2019/03/g
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后,浮动,定位将不会有效果)给父元素设置的属性:(1)display:flex---把容器设置为弹性盒模型。(2)flex-direction---设置弹性盒模型主轴方向默认情况下主
我在网页上运行了一个Flex应用程序,我想使用Command←组合键在应用程序中触发某些操作.这在大多数浏览器上都很好,但在Safari上,浏览器拦截此键盘事件并导致浏览器“返回”事件.有没有办法,通过Flex或通过页面上的其他地方的JavaScript,我可以告诉Safari不要这样做?解决方法:简短的
flex布局,flex-item1<template>2<viewclass="container">3<viewclass="greentxt">4A5</view>6<viewclass="redtxt">7B8<
我应该设计一个大型多点触控屏幕的应用程序.从大到大,我的意思是新闻广播员(大约55英寸及以上).该应用程序是一个交互式地图.我的问题是:开发应用程序的技术.我的第一个想法是在AdobeFlex中制作,但是HTML5也是如此……必须有一些非常棒的Java库用于触摸交互,但是在Windows平台上
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><metahttp-equiv="X-UA-Compatible&quo
【1】需求:  【2】解决方案:最近遇到布局上要求item两端对齐,且最后一行在列不满的情况下要求左对齐,使用flex的justify-content:space-between;实现时发现最后一行不能左对齐,而是两端对齐方式。 不是项目上想要的效果#网上查了一些资料,有两种方法可以实现效果:**1.
我有一个java套接字服务器,它在连接时将Animal对象发送到Flash客户端.对象发送方式如下:Amf3Outputamf3Output=newAmf3Output(SerializationContext.getSerializationContext());amf3Output.setOutputStream(userSocket.getOutputStream());amf3Output.writeObject(animal)
我正在开发一个Flex3.4应用程序,它通过最新版本的BlazeDS与JBoss-4.2.2服务器上运行的JavaEE后端进行交互.当我在Tomcat上从FlashBuilder4beta2运行Flex应用程序时,一切都很好,Flex应用程序能够进行所需的远程调用.但我的生产环境是在JBoss上,当我将应用程序移动到JBoss时(更
我有一个非常大的问题.我使用Flex3/Tomcat/BlazeDS/Spring编写了一个大型应用程序,在本地开发时运行良好,当我部署到公共开发环境时很好,但是当部署到我们的测试环境时经常失败.当远程处理请求花费大量时间(超过20秒)时,故障似乎最常发生.在我的开发服务器上,错误发生,但仅
弹性和布局display:flex在ie6,ie7不兼容状态,一般在pc用的比较少,在手机端所有的浏览器都是支持的控制子元素在父元素里面的位置关系display:flex是给父元素加的文档流是按照主轴排列,只要父元素加了flex,那么里面的子元素全部可以直接添加宽高主轴的方向
FLEX2.0源码分析(一)https://www.jianshu.com/p/8bc4c5f4b19fFLEX源码分析二(网络监测swizzle)https://www.jianshu.com/p/ffb95f2cbda6FLEX源码分析三(网络监测记录FLEXNetworkRecorder)https://www.jianshu.com/p/66267dc922c5FLEX源码分析四(Systemlog)https://www.jianshu.
1<!DOCTYPEhtml>2<htmllang="en">3<head>4<metacharset="UTF-8">5<title><itle>6<style>7*{8margin:0;9padding:0;10
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><metahttp-equiv="X-UA-Compatible&qu
flex:将对象作为弹性伸缩盒显示inline-flex:将对象作为内联块级弹性伸缩盒显示两者都是使子元素们弹性布局,但是如果是flex,父元素的尺寸不由子元素尺寸动态调整,不设置时默认是100%,而inline-flex则会使父元素尺寸跟随子元素们的尺寸动态调整。
<html><head><metacharset="utf-8"><metaname="viewport"content="width=device-width"><title>test<itle><stylemedia="screen">.tab-head{list-style-type:no
有没有办法使用邮政编码找到径向距离?我的任务是搜索居住在指定距离内的所有用户.我知道用户的zipcodes.例如,距离当前位置25英里的用户.我有其他搜索类别,我正在使用mysql查询.我无法解决距离问题.我的后端是在PHP中Flex的前端和前端.对我来说最好的选择就是www.zip-codes.com