MonteCristo
MonteCristo

Reputation: 1550

Toggle CSS style on click

Scratching my head over this for a while now I will lose hair soon.

I have a site here: http://ve.jago-staging.com/ I am trying to figure out how I can alter the code below so that when I click on featured posts the transition occurs same way, instead of just the round click links.

I've seen examples where I click on the element itself and it change style but not externally controlled.

round click still need to work

Thanks for the help

(function($) {
        $(document).ready( function() {
            $('.feature-slider a').click(function(e) {
                $('.featured-posts section.featured-post').css({
                    opacity: 0,
                    visibility: 'hidden'
                });
                $(this.hash).css({
                    opacity: 1,
                    visibility: 'visible'
                });
                $('.feature-slider a').removeClass('active');
                $(this).addClass('active');
                e.preventDefault();
            });
        });
    })(jQuery);

Upvotes: 0

Views: 2521

Answers (1)

paul_ngc
paul_ngc

Reputation: 111

Do this:

$(document).ready( function() {
        $('.feature-slider a').click(function(e) {
            $('.featured-posts section.featured-post').toggleClass('your-extra-css');
        });
    });

And add the css stuff in your css:

.your-extra-css {
visibility:visible;
}

Upvotes: 3

Related Questions