0

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);
2
  • And what's the 'round click' that still needs to work..? Commented Apr 26, 2012 at 19:25
  • jsfiddle.net/shavindra/PJAc8 I've simplified the code hopefully its more clearer now? Commented Apr 27, 2012 at 14:57

1 Answer 1

2

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;
}
Sign up to request clarification or add additional context in comments.

1 Comment

You should not add the class 'your-extra-css' to the document already. jQuery does that for you after you click the h1 ;) When jQuery adds the class you tell with your css code what it should do. As long the class is not added the 'featured-post' class is hidden or not displayed. I've edited the code for you: jsfiddle.net/PJAc8/4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.