Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Jquery Scroll

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #32639
    Waffle
    Member
    $(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.

    #77161

    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.

    #77150
    Chris Coyier
    Keymaster

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.