Grow your CSS skills. Land your dream job.

Jquery Scroll

  • # May 8, 2011 at 1:22 pm
    $(function(){

    $('.ContactArea').hide();

    $('.Portfolio').hide();

    $('.WebDesign').hide();

    $('.AboutCoadin').hide();


    $('li.Contact').click(function(){
    $(".ContactArea").slideToggle();
    });

    $('li.PortfolioBtn').click(function(){
    $(".Portfolio").slideToggle();
    });

    $('li.WebDesignBtn').click(function(){
    $(".WebDesign").slideToggle();
    });

    $('li.AboutBtn').click(function(){
    $(".AboutCoadin").slideToggle();
    });


    });

    Hey, This is Jquery for some buttons to make some divs slide down and slide back up.

    I also want the page to scroll to those divs when those buttons are pressed, any ideas how that would work? I know jquery, but not that well.

    # May 8, 2011 at 4:08 pm

    Hmm, I think you’d do something like use .offset and .top to find the position of the div then .animate scrollTop to move the page to it. Have that bound to .click on on the relevant li tag.

    # May 8, 2011 at 6:35 pm

    I used this post as a case study blog post: http://css-tricks.com/case-study-jquery-fixer-upper/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".