Advertisement
pushrbx

Patrik Help

Aug 29th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 4.52 KB | None | 0 0
  1. <style>
  2. .tableContainer {
  3.     position: relative;
  4.     z-index: inherit;
  5.     width: 100%;
  6.     margin: 0 auto;
  7.     display: block;
  8.     //float: left;
  9.     overflow: visible;
  10.     //height: 350px;
  11. }
  12. .tableContainer > ul {
  13.     width: 100%;
  14.     z-index: 0;
  15.     display: inline-block;
  16.     position: relative;
  17.     overflow: visible;
  18. }
  19. .tableContainer > ul > li {
  20.     width: 100%;
  21.     display: block;
  22.     position: absolute;
  23. }
  24. </style>
  25. <script>
  26. //
  27. // Mindent tegyél a helyére, a megfelelo fájlba! Ne legyen inline cumó.
  28. //
  29.  
  30.  
  31. /// switcher jQuery plugin
  32. $.fn.tabs = function(o) {
  33.     return this.each(function() {
  34.         var th = $(this), _ = th.data('tabs')
  35.                 || {
  36.                     enable : true,
  37.                     show : 0,
  38.                     blockSame : true,
  39.                     changeEv : 'change',
  40.                     empty : '#!/',
  41.                     preFu : function() {
  42.                         _.li.hide()
  43.                     },
  44.                     actFu : function() {
  45.                         _.prev && _.prev.hide()
  46.                         _.curr && _.curr.show()
  47.                     },
  48.                     searchSubCatFu: function(s) {
  49.                         var subtest = -1;
  50.                         var subcat = false;
  51.  
  52.                         if(s.slice(0, 3) == '#!/') {
  53.                             subtest = s.slice(3).indexOf('/');
  54.  
  55.                             if(subtest >= 0) {
  56.                                 subcat = s.slice(subtest + 4);
  57.                                 if(subcat.indexOf('/') >= 0) {
  58.                                     return _.searchSubCatFu(subcat);
  59.                                 }
  60.  
  61.                                 return subcat;
  62.                             }
  63.  
  64.                             return s.slice(3);
  65.                         }
  66.                         else {
  67.                             subtest = s.indexOf('/');
  68.                             if(subtest >= 0) {
  69.                                 subcat = s.slice(subtest + 1);
  70.                                 if(subcat.indexOf('/') >= 0) {
  71.                                     return _.searchSubCatFu(subcat);
  72.                                 }
  73.                                 return subcat;
  74.                             }
  75.                         }
  76.  
  77.                         return false;
  78.                     },
  79.                     navFu : function(s) {
  80.                         if (_.pres == s || s.slice(0, 3) != '#!/')
  81.                             return false
  82.                         _.pres = s
  83.                         s == _.empty && $.when(_.li).then(_.closeFu)
  84.                         var found = false;
  85.                         var needle = _.searchSubCatFu(s);
  86.  
  87.                         _.li.each(function(n) {
  88.                             if($(this).attr('id') == needle){
  89.                                 _.chngFu(n);
  90.                                 $(document).trigger("pageChange", $(this));
  91.                             }
  92.                         })
  93.                     },
  94.                     chngFu : function(a) {
  95.                         if (!_.enable || (a == _.n && _.blockSame)
  96.                                 || a >= _.li.length)
  97.                             return false
  98.                         $.when(_.li).then(function() {
  99.                             _.pren = _.n
  100.                             _.prev = _.curr
  101.                             _.curr = _.li.eq(_.n = a)
  102.                             _.actFu(_)
  103.                             _.me.trigger(_.changeEv)
  104.                         })
  105.                     },
  106.                     nextFu : function() {
  107.                         var n = _.n
  108.                         _.way = 1
  109.                         _.chngFu(++n < _.li.length - _.show ? n : 0)
  110.                     },
  111.                     prevFu : function() {
  112.                         var n = _.n
  113.                         _.way = -1
  114.                         _.chngFu(--n >= 0 ? n : _.li.length - 1 - _.show)
  115.                     },
  116.                     closeFu : function() {
  117.                         if (_.pres == 'close')
  118.                             return false
  119.                         _.pren = _.n
  120.                         _.prev = _.curr
  121.                         _.n = -1
  122.                         _.curr = false
  123.                         _.pres = 'close'
  124.                         _.actFu(_)
  125.                     },
  126.                     backFu : function() {
  127.                         _.chngFu(_.pren)
  128.                     },
  129.                     init : function() {
  130.                         _.ul = $('>ul', _.me)
  131.                         _.li = $('>li', _.ul)
  132.                         _.preFu(_)
  133.                         _.navs && _.navs.navs(function(n) {
  134.                             th.tabs(n)
  135.                         })
  136.                     }
  137.                 }
  138.  
  139.         if (typeof o == 'object')
  140.             _ = $.extend(true, _, o)
  141.  
  142.         _.me || _.init(_.me = th.data({
  143.             tabs : _
  144.         }))
  145.  
  146.         typeof o == 'function' && _.me.bind(_.changeEv, function() {
  147.             o(_.n, _);
  148.             return false
  149.         })
  150.         typeof o == 'boolean' && (_.enable = o)
  151.         typeof o == 'number' && _.chngFu(o)
  152.         typeof o == 'string'
  153.                 && (o == 'prev' || o == 'next' || o == 'close'
  154.                         || o == 'back' ? _[o + 'Fu']() : _.navFu(o))
  155.     })
  156. }
  157.  
  158. // main
  159.  
  160. if(window.jQuery) {
  161.     var j = jQuery.noConflict();
  162.     j(document).ready(function() {
  163.         j(".tblNavs a").click(function() {
  164.             j.tblControl.tabs(j(this).data("command"));
  165.         });
  166.     });
  167.     j(window).load(function() {
  168.         j.tblControl = j(".tableContainer");
  169.         j.tblControl.tabs({
  170.             preFu: function(_) {
  171.                 _.li.css({
  172.                     left: "-1700px",
  173.                     'display': 'none'
  174.                 });
  175.             },
  176.             actFu: function(_) {
  177.                 if(_.curr) {
  178.                     _.curr.css({
  179.                         'display': 'block',
  180.                         left: "1700px"
  181.                     }).stop().delay(200).animate({
  182.                         left: "0px"
  183.                     }, 700, "easeOutCubic");
  184.                
  185.                 }
  186.                 if (_.prev) {
  187.                     _.prev.stop().animate({
  188.                         left : '-1700px'
  189.                     },
  190.                     700,
  191.                     'easeInOutCubic',
  192.                     function() {
  193.                         _.prev
  194.                                 .css({
  195.                                     'display' : 'none'
  196.                                 });
  197.                     });
  198.                 }
  199.             }
  200.         });
  201.     });
  202. }
  203.  
  204. </script>
  205. <div class="tableContainer">
  206.     <ul>
  207.         <li class="page"><table id="squad1></table></li>
  208.         <li class="page"><table id="squad2></table></li>
  209.     </ul>
  210.     <div class="tblNavs">
  211.         <a href="#" data-command="next">Következő oldal</a>
  212.         <a href="#" data-command="prev"></a>
  213.     </div>
  214. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement