[30050] | 1 | <script type="text/javascript"> |
---|
| 2 | var MRP_Opt={ |
---|
| 3 | showName:"{$data.showname}", |
---|
| 4 | showComment:"{$data.showcomment}", |
---|
| 5 | pictures:[ |
---|
| 6 | {foreach from=$data.pictures item=picture name=items} |
---|
| 7 | {ldelim} |
---|
| 8 | 'comment':'{$picture.comment|escape:'quotes'|replace:"\n":'<br>'|replace:"\r":''}', |
---|
| 9 | 'link':"{$picture.link}", |
---|
| 10 | 'name':'{$picture.imgname|escape:'quotes'|replace:"\n":'<br>'|replace:"\r":''}', |
---|
| 11 | 'thumb':"{$picture.thumb}" |
---|
| 12 | {rdelim}{if !$smarty.foreach.items.last},{/if} |
---|
| 13 | {/foreach} |
---|
| 14 | ] |
---|
| 15 | }; |
---|
| 16 | |
---|
| 17 | $(function() { |
---|
| 18 | $('#imrp_ill0').width({$data.blockHeight}); |
---|
| 19 | $('#imrp_ill0').height({$data.blockHeight}); |
---|
| 20 | |
---|
| 21 | var randomPict = MRP_Opt['pictures']; |
---|
| 22 | if (randomPict.length > 1) { |
---|
| 23 | $('#imrp_ill0 a').attr("href", randomPict[0]['link']); |
---|
| 24 | $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']); |
---|
| 25 | |
---|
| 26 | var nextFaderPos = 1; |
---|
| 27 | var duration = 400; |
---|
| 28 | var pause = false; |
---|
| 29 | |
---|
| 30 | $('#imrp_ill0 img').after('<img id="irmbRPicImg">'); |
---|
| 31 | $('#imrp_ill0 img').eq(1).hide(); |
---|
| 32 | $('#imrp_ill0 img')[1].src = randomPict[1]['thumb']; |
---|
| 33 | $('#imrp_ill0 img').css('position', 'absolute'); |
---|
| 34 | |
---|
| 35 | $('#imrp_ill0').hover(function() { |
---|
| 36 | pause = true; |
---|
| 37 | },function() { |
---|
| 38 | pause = false; |
---|
| 39 | }); |
---|
| 40 | |
---|
| 41 | function doRotate() { |
---|
| 42 | if ($('#imrp_ill0 img')[1].complete) { |
---|
| 43 | if(!pause) { |
---|
| 44 | $('#imrp_ill0 img').first().fadeOut(duration, function() { |
---|
| 45 | nextFaderPos = (nextFaderPos + 1) % randomPict.length; |
---|
| 46 | $('#imrp_ill0 img')[1].src = randomPict[nextFaderPos]['thumb']; |
---|
| 47 | }); |
---|
| 48 | $('#imrp_ill0 img').first().insertAfter($('#imrp_ill0 img').eq(1)); // swap |
---|
| 49 | $('#imrp_ill0 img').first().fadeIn(duration); |
---|
| 50 | setTimeout(function() { |
---|
| 51 | $('#imrp_ill0 a').attr("href", randomPict[nextFaderPos]['link']); |
---|
| 52 | }, duration/3); |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | var rotate = setInterval(doRotate, {$data.delay}); |
---|
| 58 | } |
---|
| 59 | }); |
---|
| 60 | </script> |
---|