Subversion-Projekte lars-tiefland.webanos.zeldi.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
4 lars 1
<script>
2
    $(document).ready(function(){
3
        var windowWidth = $(window).width();
4
        removeMobileNav(windowWidth);
5
 
6
        $('.menu_close').on("click",function() {
7
            $('.subnav').removeClass('topnav-hover');
8
            $('.sub2container').removeClass('topnav-hover');
9
            $('body').removeClass("active-nav");
10
            $('.menu_path').html("Menü");
11
        });
12
 
13
        $('.topnav_next').on("click",function() {
14
            let id = $(this).data("id");
15
            let name = $(this).data("name");
16
            let closename = $(this).data("closename");
17
 
18
            if(id.indexOf("sub2_")==0) {
19
                $('.menu_path').attr("data-close","sub2container");
20
            }else {
21
                $('.menu_path').attr("data-close","subnav");
22
                $('.subnav').removeClass('topnav-hover');
23
                closename = "Menü";
24
            }
25
 
26
 
27
            $('.menu_path').attr("data-closename",closename);
28
            $('.menu_path').attr("data-id",id);
29
            $('#'+id).addClass('topnav-hover');
30
            $('.menu_path').html("<i class='sub_close fa fa-chevron-left' aria-hidden='true'> "+name+"</i>");
31
 
32
        });
33
 
34
 
35
        $('.menu_path').on("click",function() {
36
 
37
            let closeItem = $(this).data("id");
38
            let closename = $(this).data("closename");
39
            let closeclass = $(this).data("close");
40
 
41
            if($(".sub2container").is("visible")==false) {
42
                $('.menu_path').html("Menü");
43
                $(".sub2container").removeClass('topnav-hover');
44
                $(".subnav").removeClass('topnav-hover');
45
            }else {
46
                if( closeItem  ) {
47
                    $('.menu_path').html("<i class='sub_close fa fa-chevron-left' aria-hidden='true'> " + closename);
48
                    $('.menu_path').data("closename", closename);
49
                    $("#"+closeItem).removeClass('topnav-hover');
50
                    if(closeclass) {
51
                        $('.'+closeclass).removeClass('topnav-hover');
52
                    }
53
                }
54
            }
55
 
56
        });
57
 
58
 
59
 
60
        /*
61
        $(".topnav_ul li").hoverIntent(
62
            function(){
63
                var topLvl = String( $(this).attr("class") );
64
 
65
                var topExpl = topLvl.split("_");
66
                var topId = topExpl[1];
67
                $(this).removeClass('highlight');
68
 
69
                if( windowWidth > 850){
70
                    $('.subnav').removeClass("topnav-hover");
71
                    $('.sub_'+topId).addClass("topnav-hover");
72
                    $(".topnav_ul li").removeClass('highlight');
73
                }
74
            }, function(){
75
                var topLvl = String( $(this).attr("class") );
76
                var topExpl = topLvl.split("_");
77
                var topId = topExpl[1];
78
                $('.sub_'+topId).removeClass("topnav-hover");
79
                $(".topnav_ul li").removeClass('highlight');
80
            }
81
 
82
        );
83
 
84
        $(".opener").hoverIntent(
85
            function(){
86
                $('.opener').removeClass("highlight");
87
                $('.subdir_box').hide();
88
                let id = $(this).attr("id");
89
                $(this).addClass("highlight");
90
                $('#sub_'+id).css("display","flex");
91
            }, function(){
92
 
93
            }
94
        );
95
        */
96
 
97
 
98
        $(".subnavClose").on( "click", function(){
99
            $('.subnav').removeClass("topnav-hover");
100
            $('.subnav').css("visibility", "hidden");
101
        });
102
 
103
        // height subnav
104
        /*
105
        var maxHeight = 0;
106
        $(".subnav_inner_container").each(function(){
107
            var actHeight = $(this).height();
108
 
109
            if( maxHeight == 0 ){
110
                maxHeight = actHeight;
111
            }else{
112
                if( maxHeight < actHeight ){
113
                    maxHeight = actHeight;
114
                }
115
            }
116
        });
117
        if( maxHeight > 0 ){
118
            $(".subnav_inner_container").css("height", maxHeight + 30);
119
        }
120
        */
121
 
122
        function removeMobileNav(w) {
123
            if(w>850) {
124
                $('.mobileNav').remove();
125
            }
126
        }
127
    });
128
</script>
129
<style>
130
.subs {
131
    width:55%;
132
    transition:all 200ms ease;
133
}
134
.subnav_paddings:hover .subdir_box {
135
    display:flex;
136
}
137
.subs .subnav-hover {
138
    display:flex;
139
}
140
.subs .subdir_box {
141
    display:none;
142
    flex-wrap:wrap;
143
    transition:all 200ms ease;
144
 
145
}
146
.subs .subdir_box span {
147
    min-width:33.33%;
148
    transition:all 200ms ease;
149
}
150
.opener.highlight,
151
.opener:hover,
152
.opener:focus {
153
    background:#DDDEDE;
154
}
155
.mobile .menu_top {
156
    display:flex!important;
157
    flex-direction:column;
158
    overflow:hidden;
159
    max-width:100%;
160
    background: rgb(233,88,1);!important;
161
    background: linear-gradient(130deg, rgba(233,88,1,1) 0%, rgba(251,149,24,1) 100%, rgba(0,212,255,1) 100%)!important;
162
    color:#fff;
163
    padding:0;
164
}
165
.mobile .menu_close {
166
    padding: 2% !important;
167
    text-align: right;
168
    width: 96% !important;
169
    font-size:1.4rem;
170
}
171
.mobile .menu_path {
172
    padding:2%!important;
173
    text-transform:uppercase;
174
    font-size:1.2rem;
175
}
176
.mobile .topnav_next {
177
    cursor:pointer;
178
}
179
.mobile .topnav_next i {
180
    color:#E95902!important;
181
    text-align:right!important;
182
}
183
.mobile .topnav_ul > li {
184
    display:flex;
185
}
186
.mobile .subnav {
187
    background:#fff;
188
    left:100%;
189
    height:100vh!important;
190
}
191
.mobile .topnav-hover.subnav {
192
    left:0;
193
}
194
.mobile .sub_head {
195
    border-bottom:1px solid #ccc;
196
    font-size:1.1em;
197
    display:flex;
198
}
199
.mobile .sub_head > a {
200
    padding:4% 3%!important;
201
    display:block;
202
}
203
#topnav.mobile .inner {
204
    height:100vh!important;
205
}
206
.mobile .topnav_nextsub  {
207
    text-align:right;
208
}
209
.mobile .topnav_nextsub i {
210
    color:#E95902 !important;
211
}
212
.mobile .subs {
213
    position:absolute;
214
    left:100%;
215
    background:#fff;
216
}
217
.mobile .sub2 {
218
    padding:4% 3%!important;
219
    border-bottom:1px solid #ccc;
220
    font-size:1.1em;
221
}
222
.mobile .sub2container {
223
    position:absolute;
224
    left:100%;
225
    background:#fff;
226
}
227
.mobile .sub2container {
228
    height:100vh!important;
229
}
230
.mobile .sub2container.topnav-hover {
231
    left:0!important;
232
}
233
 
234
</style>
235
<nav class="topnav noprint">
236
    <div class="menu_top mobile">
237
        <div class="menu_close"><i class="fa fa-times" aria-hidden="true"></i></div>
238
        <div class="menu_path fa" data-id="subnav">Menü</div>
239
    </div>
240
    <div class="inner">
241
        <ul class="topnav_ul">
242
        {foreach $nav as $n name=navigation}
243
            {foreach $n.top as $top }
244
            <li class="{if $n@last}last{/if} li_{$top.id}">
245
                <a class="topnav_li" id="{$top.id}" href="{$top.dirLink}" title="Zu {$top.name}">{$top.name}</a>
246
                {if $smarty.session.isMobile==true}
247
                    {if is_array($n.sub) && $n.sub|count>0}
248
                        <a class="topnav_next mobile" data-closename="Menü" data-id="sub_{$top.id}" data-name="{$top.name}"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>
249
                    {/if}
250
                {/if}
251
            </li>
252
            {/foreach}
253
        {/foreach}
254
        </ul>
255
        {foreach $nav as $n}
256
            {foreach $n.top as $top}
257
                {if $n.sub|is_array && $n.sub|count}
258
                <div class="subnav sub_{$top.id}" id="sub_{$top.id}">
259
                   <div class="subnav_outer_container">
260
 
261
                        <div class="subnav_inner_container">
262
                          <div class="subnav_paddings">
263
 
264
                            <div class="subdir_col">
265
                                {* 1st level opener *}
266
                                {section loop=$n.sub start=0 name=s_ind}
267
                                    {if $n.sub[s_ind].link}
268
                                        <div id="{$n.sub[s_ind].id}" class="opener {if $smarty.section.s_ind.last}subdir_last{/if}">
269
                                            <span class="sub_head">
270
                                                <a href="{$n.sub[s_ind].link}" title="Zu {$n.sub[s_ind].name}">{$n.sub[s_ind].name}</a>
271
                                                {if $smarty.session.isMobile==true}
272
                                                    {if is_array($n.sub[s_ind].sub2)}
273
                                                        <a class="topnav_next mobile" data-closename="{$top.name}" data-id="sub2_{$n.sub[s_ind].id}" data-name="{$n.sub[s_ind].name}"><i class="fa fa-chevron-right" aria-hidden="true"></i></a>
274
                                                    {/if}
275
                                                {/if}
276
                                            </span>
277
                                        </div>
278
 
279
                                        {if $n.sub[s_ind].id}
280
                                            {if is_array($n.sub[s_ind].sub2)}
281
                                            <div id="sub2_{$n.sub[s_ind].id}" class="sub2container">
282
                                            {foreach $n.sub[s_ind].sub2 as $sub3}
283
                                                <div>
284
                                                  <span class="sub2"><a data-closename="{$n.sub[s_ind].name}" data-id="sub_{$top.id}" href="{$sub3.dirLink}" title="Zu {$sub3.Name}">{$sub3.Name}</a></span>
285
                                                </div>
286
                                            {/foreach}
287
                                            </div>
288
                                            {/if}
289
                                        {/if}
290
 
291
                                    {/if}
292
                                {/section}
293
 
294
                            </div>
295
 
296
 
297
 
298
 
299
 
300
 
301
 
302
 
303
 
304
                            {if !$smarty.session.isMobile}
305
                            <div class="subnav_special">
306
 
307
                            </div>
308
                            {/if}
309
 
310
 
311
                           </div>
312
                        </div>
313
                    </div>
314
                </div>
315
                {/if}
316
            {/foreach}
317
        {/foreach}
318
    </div>
319
</nav>