source: extensions/MenuRandomPhoto/mrp.js @ 32011

Last change on this file since 32011 was 31894, checked in by romanf, 7 years ago

Copy/Paste Error

  • Property svn:executable set to *
File size: 1.6 KB
RevLine 
[31892]1$(function()
2{
3    if (typeof MRP_blockHeight === 'undefined')
4        return;
[31780]5
[31892]6    $('#imrp_ill0').width(MRP_blockHeight);
7    $('#imrp_ill0').height(MRP_blockHeight);
[31780]8
[31892]9    var randomPict = MRP_Opt['pictures'];
[31893]10    if (randomPict.length > 1 && $("#mbRandomPhoto").length > 0) 
[31892]11    {
12        $('#imrp_ill0 a').attr("href", randomPict[0]['link']);
13        $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);
[31780]14
[31894]15        var nextFaderPos = 1;
16        var duration = 400;
17        var pause = false;
[31780]18
[31894]19        $('#imrp_ill0 img').after('<img id="irmbRPicImg">');
20        $('#imrp_ill0 img').eq(1).hide();
21        $('#imrp_ill0 img')[1].src = randomPict[1]['thumb'];
22        $('#imrp_ill0 img').css('position', 'absolute');
[31780]23
[31894]24        $('#imrp_ill0').hover(function() { pause = true; },function() { pause = false; });
[31892]25
[31894]26        function doRotate()
27        {
28            if ($('#imrp_ill0 img')[1].complete)
[31892]29            {
[31894]30                if(!pause)
[31892]31                {
[31894]32                    $('#imrp_ill0 img').first().fadeOut(duration, function() {
33                        nextFaderPos = (nextFaderPos + 1) % randomPict.length;
34                        $('#imrp_ill0 img')[1].src = randomPict[nextFaderPos]['thumb'];
35                        });
36                    $('#imrp_ill0 img').first().insertAfter($('#imrp_ill0 img').eq(1)); // swap
37                    $('#imrp_ill0 img').first().fadeIn(duration);
38                    setTimeout(function() {
39                        $('#imrp_ill0 a').attr("href", randomPict[nextFaderPos]['link']);
40                        }, duration/3);
[31892]41                }
42            }
[31894]43        }
[31893]44
[31894]45        var rotate = setInterval(doRotate, MRP_delay);
[31780]46    }
47});
Note: See TracBrowser for help on using the repository browser.