source: extensions/AMenuManager/menu_templates/menubar_randompic.tpl @ 4349

Last change on this file since 4349 was 3690, checked in by grum, 15 years ago

Update AMM 2.1.1 - bug resolved + improvement
See main.inc.php file for details

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1{known_script id="jquery" src=$ROOT_URL|cat:"template-common/lib/jquery.packed.js"}
2
3<!-- random picture menu bar -->
4<dt>{$block->get_title()}</dt>
5
6{literal}
7<script type="text/javascript">
8var fixedHeight = {/literal}{$block->data.blockHeight}{literal};
9
10  function init()
11  {
12    {/literal}
13    {if $block->data.blockHeight>0}
14      $("#irandompicinner").height(fixedHeight);
15      {literal}$("#iammrpic").load( function () { computePositionTop(); } );{/literal}
16    {else}
17      {literal}
18      $("#iammrpic").load( function () { $("#irandompicinner").animate({height: ($("#iamm_ill0").innerHeight())+"px"}, "normal"); } );
19      {/literal}
20    {/if}
21    {literal}
22  }
23
24  function computePositionTop()
25  {
26    $("#iamm_ill0").css({top:(fixedHeight-$("#iamm_ill0").innerHeight())/2});
27  }
28
29  function getRandomPicture()
30  {
31    $.get("./index.php", {ajaxfct:"randompic"},
32      function (data)
33      {
34        $("#iamm_ill0").fadeTo('slow', 0, function ()
35        {
36          $("#iamm_ill0").html(data);
37
38          {/literal}
39          {if $block->data.blockHeight>0}
40            {literal}
41            $("#iammrpic").load( function () {
42              computePositionTop();
43              $("#iamm_ill0").fadeTo('slow', 1);
44            } );
45            {/literal}
46          {else}
47            {literal}
48            $("#iammrpic").load( function () {
49              $("#irandompicinner").animate({height: ($("#iamm_ill0").innerHeight())+"px"}, "normal", function ()
50              {
51                $("#iamm_ill0").fadeTo('slow', 1, function ()
52                {
53                  $("#irandompicinner").animate({height: this.clientHeight+"px"}, "normal");
54                });
55              });
56            } );
57            {/literal}
58          {/if}
59          {literal}
60
61        } );
62      }
63    );
64  }
65
66
67</script>
68{/literal}
69
70<dd id="irandompicdd" class="randompicdd">
71  <div id="irandompicinner" class="illustration">
72    <div class="ammillustrationc">
73      <div id="iamm_ill0" class="ammillustration">{$block->data.firstPicture}</div>
74    </div>
75  </div>
76</dd>
77
78<script type="text/javascript">
79  init();
80  {if $block->data.delay > 0 }
81    var vIntervalID = window.setInterval(getRandomPicture, {$block->data.delay});
82  {/if}
83</script>
Note: See TracBrowser for help on using the repository browser.