当前位置:Gxlcms > JavaScript > jquery插件splitScren实现页面分屏切换模板特效_jquery

jquery插件splitScren实现页面分屏切换模板特效_jquery

时间:2021-07-01 10:21:17 帮助过:2人阅读

闲来无事,搞了个页面的分屏效果,先来看下效果:

出于可自定义宽高的目的,屏幕分块由CSS控制,由js控制估计等分模块效果一般.

程序相关说明:

HTML结构:

  1. <div class="header">
  2. header
  3. </div>
  4. <div class="container" id="displayArea">
  5. <!-- 分屏内容渲染区域 -->
  6. </div>
  7. <div class="footer">
  8. <!--省略其他代码-->
  9. </div>

js调用:

splitScreen.js相关代码说明:

1.定义一个类

2.prototype主要方法

3.screenMode()方法说明:

主要是根据不同的分屏切换不同的Class,通过CSS类去控制分屏布局.这样写的好处应该是可以自定义布局的宽高大小,但是比较繁琐。如下:

CSS布局控制:

  1. .fp-box{position:absolute;border:1px solid #000;background:#fff;}
  2. .fp-1-1{top:0;left:0;right: 0;bottom: 0;}
  3. .fp-2-1{top:0;left:0;right: 300px;bottom: 0;}
  4. .fp-2-2{top:0;right: 0px;bottom: 0; width: 300px;}
  5. .fp-3-1{top:0;left:0;right: 300px;bottom: 0;}
  6. .fp-3-2{top:0;right: 0;width:300px;height:50%;}
  7. .fp-3-3{top:50%;right: 0;bottom: 0;width:300px;}
  8. .fp-4-1{top:0;left:0;right: 50%;height:50%;}
  9. .fp-4-2{top:50%;left:0;right: 50%;bottom: 0;}
  10. .fp-4-3{top:0;right: 0;width:50%;height:50%;}
  11. .fp-4-4{top:50%;right: 0;bottom: 0;width:50%;}
  12. .fp-5-1{top:0;left:0;right: 300px;bottom: 252px;}
  13. .fp-5-2{top:0px;width:300px;right: 0;bottom: 252px;}
  14. .fp-5-3{height: 250px;left:0;width:30%;bottom: 0;}
  15. .fp-5-4{height: 250px;left:30%;width:30%;bottom: 0;}
  16. .fp-5-5{height: 250px;left:60%;bottom: 0;right: 0;}
  17. .fp-6-1{top:0;left:0;right: 300px;bottom: 252px;}
  18. .fp-6-2{top:0;width:300px;right: 0;height:250px;}
  19. .fp-6-3{top:250px;width:300px;right: 0;bottom: 252px;}
  20. .fp-6-4{height: 250px;left:0;width:30%;bottom: 0;}
  21. .fp-6-5{height: 250px;left:30%;width:30%;bottom: 0;}
  22. .fp-6-6{height: 250px;left:60%;bottom: 0;right: 0;}

完整代码:

HTML:

  1. <meta charset="UTF-8">
  2. <title>fp version2</title>
  3. <style type="text/css">
  4. *{margin:0;padding:0;}
  5. .header{background:#ddd;height:120px;}
  6. .footerCon{width:320px;margin: 0 auto;}
  7. .footerCon .dropDiv{background: #fff; margin: 10px 0 0 0; float: left;}
  8. .footerCon .fpmodel{display: none;float: right;width:160px;}
  9. .footerCon .saveBtn{margin: 10px 0 0 10px; padding: 2px 10px;border:1px solid #CCC;cursor: pointer;}
  10. .clearFix:after{content:'';display:block;height:0;overflow:hidden;clear:both;}
  11. .footer { height: 40px; background: #ABABAB; position: fixed; bottom: 0px; width: 100%; }
  12. .footer .ulTab {list-style-type: none;width:200px;overflow: hidden;float: left;}
  13. .footer .ulTab li{float: left;height:16px;padding: 12px 15px;cursor: pointer;}
  14. .footer .ulTab li.currentLi{background: #fff;}
  15. .tabImg{width:18px;height: 14px;border:1px solid #707070;background:#fff;}
  16. .tabImg td{width: 9px;height: 5px;border:1px solid #707070;}
  17. .divImg{border-width:2px;height: 12px;}
  18. .td3Img td{height: 3px;}
  19. .currentLi .tabImg,.currentLi .tabImg td{border-color:#1e7be4;}
  20. .topbarDiv{position: absolute;left: 0;top:0;right:0;border:1px solid #dedede;z-index: 1;height:25px;padding:3px;background: #61C0FA;display: none;}
  21. .changeBtn{cursor:pointer; padding: 2px 10px;float: left;}
  22. .dropDiv,.footer .dropDiv{position: relative;width: 100px;z-index: 100;}
  23. .dropDiv .curSrc,.footer .dropDiv .curSrc{display: inline-block;height: 20px;line-height: 20px;padding: 0 2px;}
  24. .dropDiv ul,.footer .dropDiv ul{position: absolute;left: -1px;top:20px;background: #fff;width:100px;border:1px solid #1E7BE4;display: none;}
  25. .dropDiv ul li,.footer .dropDiv ul li{line-height: 20px;padding: 0 2px;}
  26. .dropDiv ul li.currentSrc,.footer .dropDiv ul li.currentSrc{background: #1E7BE4;color: #fff;cursor: pointer;}
  27. .dropDiv ul li:hover,.footer .dropDiv ul li:hover{background:#AEC9F3;color: #fff;cursor: pointer;}
  28. .optionsWrap{float: right;}
  29. .optionsWrap a{font-family: 'MicroSoft YaHei';color:#fff;text-decoration:none;float: left;}
  30. .optionsWrap a:hover{color: #fdd;cursor:pointer;}
  31. .btnBig{width: 50px;height:30px;text-align: center;}
  32. .btnSmall{width: 50px;height:30px;text-align: center;}
  33. .btnCls{width: 50px;height:30px;text-align: center;}
  34. /*分屏模块布局*/
  35. .container{position: relative;}
  36. .fp-box{position:absolute;border:1px solid #000;background:#fff;}
  37. .fp-1-1{top:0;left:0;right: 0;bottom: 0;}
  38. .fp-2-1{top:0;left:0;right: 300px;bottom: 0;}
  39. .fp-2-2{top:0;right: 0px;bottom: 0; width: 300px;}
  40. .fp-3-1{top:0;left:0;right: 300px;bottom: 0;}
  41. .fp-3-2{top:0;right: 0;width:300px;height:50%;}
  42. .fp-3-3{top:50%;right: 0;bottom: 0;width:300px;}
  43. .fp-4-1{top:0;left:0;right: 50%;height:50%;}
  44. .fp-4-2{top:50%;left:0;right: 50%;bottom: 0;}
  45. .fp-4-3{top:0;right: 0;width:50%;height:50%;}
  46. .fp-4-4{top:50%;right: 0;bottom: 0;width:50%;}
  47. .fp-5-1{top:0;left:0;right: 300px;bottom: 252px;}
  48. .fp-5-2{top:0px;width:300px;right: 0;bottom: 252px;}
  49. .fp-5-3{height: 250px;left:0;width:30%;bottom: 0;}
  50. .fp-5-4{height: 250px;left:30%;width:30%;bottom: 0;}
  51. .fp-5-5{height: 250px;left:60%;bottom: 0;right: 0;}
  52. .fp-6-1{top:0;left:0;right: 300px;bottom: 252px;}
  53. .fp-6-2{top:0;width:300px;right: 0;height:250px;}
  54. .fp-6-3{top:250px;width:300px;right: 0;bottom: 252px;}
  55. .fp-6-4{height: 250px;left:0;width:30%;bottom: 0;}
  56. .fp-6-5{height: 250px;left:30%;width:30%;bottom: 0;}
  57. .fp-6-6{height: 250px;left:60%;bottom: 0;right: 0;}
  58. </style>
  59. <div class="header">
  60. header
  61. </div>
  62. <div class="container" id="displayArea">
  63. <!-- 分屏内容区 -->
  64. </div>
  65. <div class="footer">
  66. <div class="footerCon clearFix">
  67. <ul class="ulTab">
  68. <li class="currentLi" data-fp="1" onclick="changeModel(this)">
  69. <div class="tabImg divImg"></div>
  70. </li>
  71. <li data-fp="3" onclick="changeModel(this)">
  72. <table class="tabImg" cellpadding="0" cellspacing="0">
  73. <tbody><tr>
  74. <td rowspan="2"></td>
  75. <td></td>
  76. </tr>
  77. <tr>
  78. <td></td>
  79. </tr>
  80. </tbody></table>
  81. </li>
  82. <li data-fp="6" onclick="changeModel(this)">
  83. <table class="tabImg td3Img" cellpadding="0" cellspacing="0">
  84. <tbody><tr>
  85. <td rowspan="2" colspan="2"></td>
  86. <td></td>
  87. </tr>
  88. <tr>
  89. <td></td>
  90. </tr>
  91. <tr>
  92. <td></td>
  93. <td></td>
  94. <td></td>
  95. </tr>
  96. </tbody></table>
  97. </li>
  98. <li data-fp="setting" onclick="changeModel(this)" title="设置">
  99. <table class="tabImg td3Img" cellpadding="0" cellspacing="0">
  100. <tbody><tr>
  101. <td rowspan="2" colspan="2"></td>
  102. <td></td>
  103. </tr>
  104. <tr>
  105. <td></td>
  106. </tr>
  107. <tr>
  108. <td></td>
  109. </tr>
  110. </tbody></table>
  111. </li>
  112. </ul>
  113. </div>
  114. </div>

JS:

以上所述就是本文的全部内容了,希望大家能够喜欢。

人气教程排行