Signin  Pricing  Examples  Support

Libraries > accordion.js

accordion.js - Search Live Website Code
It's like doing CTRL+F on millions of websites' source code



NerdyData is a search engine for source code. Search the source code of 200 million websites.


JAVASCRIPT FILE https://utahhumane.org/sites/all/themes/puppies/js/accordion.js


Libraries on utahhumane.org


jquery.once.js

jquery.colorbox-min.js

owl.carousel.min.js

colorbox_inline.js

colorbox.js

colorbox_style.js

googleanalytics.js

pets_saved.js

jquery.min.js

owlcarousel.settings.js

picturefill.min.js

picture.min.js

piwik.js

contextual.js

html5.js

respond.min.js

accordion.js

home-donation.js

pet-listing.js

script.js



Explore More


jquery-1.3.min.js

jquery.sliderkit.1.8.min.js

jquery-1.6.2.min.js

jquery-1.3.min.js

accordion.js
				
(function($){
    $(function(){
        this.accordionsClass = ".field-name-field-accordion-content";
        this.accordions = $(this.accordionsClass);
        this.accordion = null;

        this.accordionTitleClass = ".field-name-field-accordion-title";
        this.accordionItemClass = ".field-collection-item-field-accordion-content";

        this.accordionActiveClass = "active";

        this.init = function(){
            this.createAccordions();
        };

        this.createAccordions = function(){
            var _this = this;

            this.accordions.each(function(i){
                this.accordion = $(this);
                //console.log(this.accordion);
                _this.setEventHandlers(this.accordion, i);
            });
        };

        this.setEventHandlers = function(accordion, index){
            var accordionTitle = $(accordion).find(this.accordionTitleClass);
            var _this = this;

            accordionTitle.click(function(){
                var thisTitle = $(this);

                var thisParent = thisTitle.parent();
                thisParent.toggleClass(_this.accordionActiveClass);

                var siblings = thisParent.parent().siblings().find(_this.accordionItemClass);
                //console.log(siblings);
                siblings.removeClass(_this.accordionActiveClass);

                $('html,body').animate({scrollTop: $(this).offset().top},'slow');
            });
        };

        this.init();
    });
})(jQuery);


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z