Вход Регистрация
Файл: CloudBox-main/CloudBox/user_assets/js/filterable/filterable.js
Строк: 72
<?php
/*
* Copyright (C) 2009 Joel Sutherland.
* Liscenced under the MIT liscense
*/

(function($) {
    $.
fn.filterable = function(settings) {
        
settings = $.extend({
            
useHashtrue,
            
animationSpeed1000,
            
show: { width'show'opacity'show' },
            
hide: { width'hide'opacity'hide' },
            
useTagstrue,
            
tagSelector'#able-filter a',
            
selectedTagClass'current',
            
allTag'all'
        
}, settings);
        
        return $(
this).each(function(){
        
            
/* FILTER: select a tag and filter */
            
$(this).bind("filter", function( etagToShow ){
                if(
settings.useTags){
                    $(
settings.tagSelector).removeClass(settings.selectedTagClass);
                    $(
settings.tagSelector '[href=' tagToShow ']').addClass(settings.selectedTagClass);
                }
                $(
this).trigger("able", [ tagToShow.substr(1) ]);
            });
        
            
/* FILTERPORTFOLIO: pass in a class to show, all others will be hidden */
            
$(this).bind("able", function( eclassToShow ){
                if(
classToShow == settings.allTag){
                    $(
this).trigger("show");
                }else{
                    $(
this).trigger("show", [ '.' classToShow ] );
                    $(
this).trigger("hide", [ ':not(.' classToShow ')' ] );
                }
                if(
settings.useHash){
                    
location.hash '#' classToShow;
                }
            });
            
            
/* SHOW: show a single class*/
            
$(this).bind("show", function( eselectorToShow ){
                $(
this).children(selectorToShow).animate(settings.showsettings.animationSpeed);
            });
            
            
/* SHOW: hide a single class*/
            
$(this).bind("hide", function( eselectorToHide ){
                $(
this).children(selectorToHide).animate(settings.hidesettings.animationSpeed);    
            });
            
            
/* ============ Check URL Hash ====================*/
            
if(settings.useHash){
                if(
location.hash != '')
                    $(
this).trigger("filter", [ location.hash ]);
                else
                    $(
this).trigger("filter", [ '#' settings.allTag ]);
            }
            
            
/* ============ Setup Tags ====================*/
            
if(settings.useTags){
                $(
settings.tagSelector).click(function(){
                    $(
'#able-list').trigger("filter", [ $(this).attr('href') ]);
                    
                    $(
settings.tagSelector).removeClass('current');
                    $(
this).addClass('current');
                });
            }
        });
    }
})(
jQuery);


$(
document).ready(function(){
    
    $(
'#able-list').filterable();

});
?>
Онлайн: 1
Реклама