[10484] | 1 | {combine_css path="template-extension/flop_style/mainpage_categories/spotlight.css"} |
---|
[16501] | 2 | {combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'} |
---|
| 3 | {combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'} |
---|
[10484] | 4 | {footer_script require='jquery'}{literal} |
---|
[16501] | 5 | jQuery(document).ready(function () { |
---|
[10484] | 6 | |
---|
| 7 | //loop through all the children in #items |
---|
| 8 | //save title value to a span and then remove the value of the title to avoid tooltips |
---|
[16501] | 9 | jQuery('#items .item').each(function () { |
---|
| 10 | title = jQuery(this).attr('title'); |
---|
| 11 | jQuery(this).append('<span class="caption">' + title + '</span>'); |
---|
| 12 | jQuery(this).attr('title',''); |
---|
[10484] | 13 | }); |
---|
| 14 | |
---|
[16501] | 15 | jQuery('#items .item').hover( |
---|
[10484] | 16 | function () { |
---|
| 17 | //set the opacity of all siblings |
---|
[16501] | 18 | jQuery(this).siblings().css({'opacity': '0.1'}); |
---|
[10484] | 19 | |
---|
| 20 | //set the opacity of current item to full, and add the effect class |
---|
[16501] | 21 | jQuery(this).css({'opacity': '1.0'}).addClass('effect'); |
---|
[10484] | 22 | |
---|
| 23 | //show the caption |
---|
[16501] | 24 | jQuery(this).children('.caption').show(); |
---|
[10484] | 25 | }, |
---|
| 26 | function () { |
---|
| 27 | //hide the caption |
---|
[16501] | 28 | jQuery(this).children('.caption').hide(); |
---|
[10484] | 29 | } |
---|
| 30 | ); |
---|
| 31 | |
---|
[16501] | 32 | jQuery('#items').mouseleave(function () { |
---|
[10484] | 33 | //reset all the opacity to full and remove effect class |
---|
[16501] | 34 | jQuery(this).children().fadeTo('100', '1.0').removeClass('effect'); |
---|
[10484] | 35 | }); |
---|
| 36 | |
---|
| 37 | }); |
---|
| 38 | |
---|
[16501] | 39 | {/literal}{/footer_script} |
---|
| 40 | {define_derivative name='spotlight' width=$derivative_params->max_width() height=$derivative_params->max_height() crop=true} |
---|
[10484] | 41 | |
---|
| 42 | <div id="items"> |
---|
| 43 | {foreach from=$category_thumbnails item=cat} |
---|
[16501] | 44 | {assign var=derivative value=$pwg->derivative($spotlight, $cat.representative.src_image)} |
---|
| 45 | <a href="{$cat.URL}" class="item" title="{$cat.NAME|@replace:'"':' '}{if not empty($cat.DESCRIPTION)} - {$cat.DESCRIPTION|@replace:'"':' '}{/if}" style="{assign var=sz value=$derivative->get_size()}width:{$sz[0]}px;height:{$sz[1]}px"> |
---|
| 46 | <img {if $derivative->is_cached()}src="{$derivative->get_url()}"{else}src="{$ROOT_URL}{$themeconf.img_dir}/ajax-loader-big.gif" data-src="{$derivative->get_url()}"{/if} alt="{$cat.TN_ALT}" {$derivative->get_size_htm()}> |
---|
| 47 | </a> |
---|
[10484] | 48 | {/foreach} |
---|
| 49 | </div> |
---|