1 | {combine_css path="template-extension/flop_style/mainpage_categories/spotlight.css"} |
---|
2 | {footer_script require='jquery'}{literal} |
---|
3 | $(document).ready(function () { |
---|
4 | |
---|
5 | //loop through all the children in #items |
---|
6 | //save title value to a span and then remove the value of the title to avoid tooltips |
---|
7 | $('#items .item').each(function () { |
---|
8 | title = $(this).attr('title'); |
---|
9 | $(this).append('<span class="caption">' + title + '</span>'); |
---|
10 | $(this).attr('title',''); |
---|
11 | }); |
---|
12 | |
---|
13 | $('#items .item').hover( |
---|
14 | function () { |
---|
15 | //set the opacity of all siblings |
---|
16 | $(this).siblings().css({'opacity': '0.1'}); |
---|
17 | |
---|
18 | //set the opacity of current item to full, and add the effect class |
---|
19 | $(this).css({'opacity': '1.0'}).addClass('effect'); |
---|
20 | |
---|
21 | //show the caption |
---|
22 | $(this).children('.caption').show(); |
---|
23 | }, |
---|
24 | function () { |
---|
25 | //hide the caption |
---|
26 | $(this).children('.caption').hide(); |
---|
27 | } |
---|
28 | ); |
---|
29 | |
---|
30 | $('#items').mouseleave(function () { |
---|
31 | //reset all the opacity to full and remove effect class |
---|
32 | $(this).children().fadeTo('100', '1.0').removeClass('effect'); |
---|
33 | }); |
---|
34 | |
---|
35 | }); |
---|
36 | $(document).ready(function() { |
---|
37 | var max_dim_width = 0; |
---|
38 | var max_dim_height = 0; |
---|
39 | $(".item img").each(function () { |
---|
40 | if (jQuery(this).height() > max_dim_height) |
---|
41 | max_dim_height = jQuery(this).height() + 10; |
---|
42 | if (jQuery(this).width() > max_dim_width) |
---|
43 | max_dim_width = jQuery(this).width() + 10; |
---|
44 | |
---|
45 | jQuery(".item, .item img") |
---|
46 | .css('width', max_dim_width+'px') |
---|
47 | .css('height', max_dim_height+'px'); |
---|
48 | }); |
---|
49 | }); |
---|
50 | |
---|
51 | {/literal}{/footer_script} |
---|
52 | <div id="items"> |
---|
53 | {foreach from=$category_thumbnails item=cat} |
---|
54 | <a href="{$cat.URL}" class="item" title="{$cat.NAME|@replace:'"':' '}{if not empty($cat.DESCRIPTION)} - {$cat.DESCRIPTION|@replace:'"':' '}{/if}"> |
---|
55 | <img src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" > |
---|
56 | </a> |
---|
57 | {/foreach} |
---|
58 | </div> |
---|