Skip to content

Instantly share code, notes, and snippets.

@jamesstacyjones
Last active December 25, 2015 09:49
Show Gist options
  • Save jamesstacyjones/6957439 to your computer and use it in GitHub Desktop.
Save jamesstacyjones/6957439 to your computer and use it in GitHub Desktop.
toggle button with jquery and css.
<a class="togglebutton" title="Toggle Me">Toggle Me</a>
a.togglebutton {
    background: #ccc;
    cursor: pointer;
    border-top: solid 2px #eaeaea;
    border-left: solid 2px #eaeaea;
    border-bottom: solid 2px #777;
    border-right: solid 2px #777;
    padding: 5px 5px;   	
}

a.togglebutton .down {
    background: #bbb;
    border-top: solid 2px #777;
    border-left: solid 2px #777;
    border-bottom:solid 2px  #eaeaea;
    border-right: solid 2px #eaeaea;
}
$(document).ready(function(){
    $('a.togglebutton').click(function(){
        $(this).toggleClass("down");
    });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment