Ignore:
Timestamp:
Jul 8, 2012, 5:45:23 PM (12 years ago)
Author:
flop25
Message:

adding a gif loader (introduced in 2.4.2)
fixing the height of medium_cat.tpl
adding a custom size for spotlight.tpl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/flop_style/mainpage_categories/spotlight.tpl

    r16393 r16501  
    11{combine_css path="template-extension/flop_style/mainpage_categories/spotlight.css"}
     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'}
    24{footer_script require='jquery'}{literal}
    3 $(document).ready(function () {
     5jQuery(document).ready(function () {
    46 
    57    //loop through all the children in #items
    68    //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','');
     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','');
    1113    });
    1214 
    13     $('#items .item').hover(
     15    jQuery('#items .item').hover(
    1416        function () {
    1517            //set the opacity of all siblings
    16             $(this).siblings().css({'opacity': '0.1'});
     18            jQuery(this).siblings().css({'opacity': '0.1'});
    1719             
    1820            //set the opacity of current item to full, and add the effect class
    19             $(this).css({'opacity': '1.0'}).addClass('effect');
     21            jQuery(this).css({'opacity': '1.0'}).addClass('effect');
    2022             
    2123            //show the caption
    22             $(this).children('.caption').show();   
     24            jQuery(this).children('.caption').show();   
    2325        },
    2426        function () {
    2527            //hide the caption
    26             $(this).children('.caption').hide();       
     28            jQuery(this).children('.caption').hide();       
    2729        }
    2830    );
    2931     
    30     $('#items').mouseleave(function () {
     32    jQuery('#items').mouseleave(function () {
    3133        //reset all the opacity to full and remove effect class
    32         $(this).children().fadeTo('100', '1.0').removeClass('effect');     
     34        jQuery(this).children().fadeTo('100', '1.0').removeClass('effect');     
    3335    });
    3436     
    3537});
    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 });
    5038
    5139{/literal}{/footer_script}
     40{define_derivative name='spotlight' width=$derivative_params->max_width() height=$derivative_params->max_height() crop=true}
     41
    5242<div id="items">
    5343{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="{$pwg->derivative_url($derivative_params, $cat.representative.src_image)}" alt="{$cat.TN_ALT}" >
    56                         </a>
     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>
    5748{/foreach}
    5849</div>
Note: See TracChangeset for help on using the changeset viewer.