Вход Регистрация
Файл: templates/default/js/col-auto-height.js
Строк: 22
<?php
colAutoHeight 
= {
    
wrap: {},
    
col'> *',
    
wrap_width0,
    
row_width0,
    
highest_box0,
    
cols: $([]),
    
init: function(wrap_selectorcol_selector){
        
this.col col_selector || this.col;
        
this.wrap = $(wrap_selector);
        $(
window).on('resize', function(event) {
            
colAutoHeight.calc();
        });
        return 
this.calc();
    },
    
clear: function(){
        
this.row_width 0;
        
this.highest_box 0;
        
this.cols = $([]);
        return 
this;
    },
    
setHeight: function (){
        if(
this.cols.length){
            
this.cols.height(this.highest_box);
        } else {
            $(
this.colthis.wrap).last().height('auto');
        }
        return 
this;
    },
    
calc: function (){
        
this.wrap_width this.wrap.width();
        $(
this.colthis.wrap).each(function (){
            if($(
this).height() > colAutoHeight.highest_box) {
                
colAutoHeight.highest_box = $(this).height();
            }
            if((
colAutoHeight.row_width + $(this).width() + 30) > colAutoHeight.wrap_width){
                
colAutoHeight.setHeight().clear();
            } else {
                
colAutoHeight.row_width += $(this).width();
                
colAutoHeight.cols colAutoHeight.cols.add(this);
            }
        });
        return 
this.setHeight();
    }
};
?>
Онлайн: 1
Реклама