|
1 |
|
2 $(document).ready(function () { |
|
3 /* uk-nav-parent-icon */ |
|
4 $(".menu-begin ul:first-child").addClass('uk-nav uk-nav-side'); |
|
5 $(".menu-begin ul:first-child").data('uk-nav', '{multiple:false}'); |
|
6 $(".menu-begin ul:first-child").attr('data-uk-nav', '{multiple:false}'); |
|
7 |
|
8 // Parent click |
|
9 $(".uk-parent > a").on('click', function (event) { |
|
10 |
|
11 event.preventDefault(); |
|
12 $(".uk-parent > a").parent().removeClass('uk-active'); |
|
13 $(this).parent().toggleClass('uk-active'); |
|
14 |
|
15 var hash = $(this).attr('href').split('#')[1]; |
|
16 |
|
17 // scroll.To(hash); |
|
18 scrollTo(hash); |
|
19 // $('body').scrollTo(hash); |
|
20 // $('body').scrollTo(hash,{duration:'slow', offsetTop : '50'}); |
|
21 $('a[href="' + hash + '"]').addClass('uk-active'); |
|
22 }); |
|
23 |
|
24 }); |
|
25 |
|
26 function scrollTo(hash) { |
|
27 |
|
28 location.hash = "#" + hash; |
|
29 |
|
30 } |
|
31 |
|
32 function setStickyMenu () { |
|
33 |
|
34 var options = { |
|
35 bottoming: false, |
|
36 inner_scrolling: false |
|
37 }; |
|
38 |
|
39 var sticky = ".uk-overflow-container"; |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 var width = $(window).width(); |
|
47 |
|
48 if (width >= 768) { |
|
49 |
|
50 $(".uk-nav > li").addClass('uk-parent'); |
|
51 $(".menu-begin ul > li > ul").addClass('uk-nav-sub'); |
|
52 |
|
53 $('.uk-parent').removeClass('uk-open'); |
|
54 $('.uk-parent div').addClass('uk-hidden'); |
|
55 |
|
56 $(sticky).stick_in_parent(options); |
|
57 |
|
58 } else { |
|
59 |
|
60 |
|
61 $('.uk-parent').addClass('uk-open'); |
|
62 |
|
63 $('.uk-parent div').removeClass('uk-hidden'); |
|
64 $('.uk-parent div').removeAttr('style'); |
|
65 $('.uk-nav li').removeClass('uk-parent'); |
|
66 |
|
67 |
|
68 $(sticky).trigger("sticky_kit:detach"); |
|
69 } |
|
70 }; |
|
71 |
|
72 $(document).ready(function(){ |
|
73 |
|
74 $(".pager").wrapInner( '<ul class="uk-pagination-left uk-pagination"></ul>' ); |
|
75 $(".pager a").wrap( '<li></li>' ); |
|
76 $(".pager b").wrap( '<li class="uk-active"></li>' ); |
|
77 $(".pager b").wrapInner( '<span></span>' ); |
|
78 $(".pager b span").unwrap( ); |
|
79 |
|
80 // Normalize tables without style |
|
81 $( "table" ).addClass( "uk-table" ); |
|
82 |
|
83 // Normalize tables without style |
|
84 $( "form" ).addClass( "uk-form" ); |
|
85 |
|
86 |
|
87 |
|
88 }); |
|
89 |
|
90 $(document).ready(function () { |
|
91 setStickyMenu(); |
|
92 $(window).on('resize', function () { |
|
93 setStickyMenu(); |
|
94 }); |
|
95 }); |
|
96 |
|
97 |
|
98 $(document).ready(function () { |
|
99 $( 'table' ).addClass( "table" ); |
|
100 }); |
|
101 |
|
102 /* |
|
103 var scroll = (function() { |
|
104 |
|
105 var elementPosition = function(a) { |
|
106 return function() { |
|
107 return a.getBoundingClientRect().top; |
|
108 }; |
|
109 }; |
|
110 |
|
111 var scrolling = function( elementID ) { |
|
112 |
|
113 var el = document.getElementById( elementID ), |
|
114 elPos = elementPosition( el ), |
|
115 duration = 400, |
|
116 increment = Math.round( Math.abs( elPos() )/40 ), |
|
117 time = Math.round( duration/increment ), |
|
118 prev = 0, |
|
119 E; |
|
120 |
|
121 function scroller() { |
|
122 E = elPos(); |
|
123 |
|
124 if (E === prev) { |
|
125 return; |
|
126 } else { |
|
127 prev = E; |
|
128 } |
|
129 |
|
130 increment = (E > -20 && E < 20) ? ((E > - 5 && E < 5) ? 1 : 5) : increment; |
|
131 |
|
132 if (E > 1 || E < -1) { |
|
133 |
|
134 if (E < 0) { |
|
135 window.scrollBy( 0,-increment ); |
|
136 } else { |
|
137 window.scrollBy( 0,increment ); |
|
138 } |
|
139 |
|
140 setTimeout(scroller, time); |
|
141 |
|
142 } else { |
|
143 |
|
144 el.scrollTo( 0,0 ); |
|
145 |
|
146 } |
|
147 } |
|
148 |
|
149 scroller(); |
|
150 }; |
|
151 |
|
152 return { |
|
153 To: scrolling |
|
154 } |
|
155 |
|
156 })(); |
|
157 */ |