Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f7467a94

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID f7467a9450d54290b5338ab418b2451b3cbd080b
  • Vorgänger 62822c6a
  • Nachfolger 3c058d7f

Menü-Javascript umgeschrieben

Unterschiede anzeigen:

templates/webpages/menu/menu.html
1 1
[%- USE L %]
2 2
[%- USE HTML %]
3
[%- USE JSON %]
3 4
<body class="menu">
4

  
5 5
<div id='html-menu'>
6
[%- FOREACH item IN sections %]
7
 <div id='mi[% item.item_id %]' class='mi [% item.spacer %] [% item.class %]'>[%- IF item.href %]
8
  <a href="[% item.href | html %]" class='ml' target='[% item.target %]'><span class="mii ms"><div class="[% item.img %]"></div></span><span class='mic'>[% item.label %]</span></a>[%- ELSE %]
9
  <span class="mii ms"><div class="[% item.img %]"></div></span><span class='mic'>[% item.label %]</span>[%- END %]
10
 </div>
11
[%- END %]
12 6
</div>
13 7
<script type='text/javascript'>
14
  function make_img(i){
15
    var img=$('<img>');
16
    $.each(i, function(k,v){ img.attr(k,v) });
17
    return img;
18
  }
19
  function make_menu_item(b){
20
    var span1 = $('<span class="mii ms">').append(make_img(b.img));
21
    var span2 = '<span class="mic">' + b.label + '</span>';
22
    var a = $('<a class="ml">').append(span1, span2);
8
  $(function(){
9
    $([% JSON.json(sections) %]).each(function(i,b){
10
    var a = $('<a class="ml">').append(
11
     $('<span class="mii ms">').append($('<div>').addClass(b.img)),
12
     $('<span class="mic">').append(b.label));
23 13
    if (b.href) a.attr('href', b.href);
24 14
    if (b.target) a.attr('target', b.target);
25
    var mi = $('<div class="mi">').addClass(b.cl).addClass(b.spacer).attr('id', b.item_id).append(a);
26
    $('#html-menu').append(mi);
27
  }
28
  $(function(){
15
    $('#html-menu').append($('<div class="mi">').addClass(b.class).addClass(b.spacer).attr('id', 'mi' + b.item_id).append(a));
16
    });
29 17
    $('#html-menu div.i, #html-menu div.sm').hide();
30 18
    $('#html-menu div.m').each(function() {
31 19
      $(this).click(function(){

Auch abrufbar als: Unified diff