source: extensions/AMenuManager/menu_templates/menubar_randompic.js.tpl @ 5421

Last change on this file since 5421 was 4363, checked in by grum, 14 years ago

[AMM] moving the JS for the "random image" outside the <DL> tag

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1{literal}
2<script type="text/javascript">
3var fixedHeight = {/literal}{$data.blockHeight}{literal};
4var vIntervalID;
5
6  $(document).ready(
7    function ()
8    {
9      {/literal}
10      {if $data.blockHeight>0}
11        $("#irandompicinner").height(fixedHeight);
12        {literal}$("#iammrpic").load( function () { computePositionTop(); } );{/literal}
13      {else}
14        {literal}
15        $("#iammrpic").load( function () { $("#irandompicinner").animate({height: ($("#iamm_ill0").innerHeight())+"px"}, "normal"); } );
16        {/literal}
17      {/if}
18      {if $data.delay > 0 }
19        vIntervalID = window.setInterval(getRandomPicture, {$data.delay});
20      {/if}
21      {literal}
22    }
23  );
24
25  function computePositionTop()
26  {
27    $("#iamm_ill0").css({top:(fixedHeight-$("#iamm_ill0").innerHeight())/2});
28  }
29
30  function getRandomPicture()
31  {
32    $.get("./index.php", {ajaxfct:"randompic"},
33      function (data)
34      {
35        $("#iamm_ill0").fadeTo('slow', 0, function ()
36        {
37          $("#iamm_ill0").html(data);
38
39          {/literal}
40          {if $data.blockHeight>0}
41            {literal}
42            $("#iammrpic").load( function () {
43              computePositionTop();
44              $("#iamm_ill0").fadeTo('slow', 1);
45            } );
46            {/literal}
47          {else}
48            {literal}
49            $("#iammrpic").load( function () {
50              $("#irandompicinner").animate({height: ($("#iamm_ill0").innerHeight())+"px"}, "normal", function ()
51              {
52                $("#iamm_ill0").fadeTo('slow', 1, function ()
53                {
54                  $("#irandompicinner").animate({height: this.clientHeight+"px"}, "normal");
55                });
56              });
57            } );
58            {/literal}
59          {/if}
60          {literal}
61
62        } );
63      }
64    );
65  }
66
67  {/literal}
68
69  {literal}
70
71
72</script>
73{/literal}
Note: See TracBrowser for help on using the repository browser.