Created
January 11, 2012 16:06
-
-
Save program247365/1595369 to your computer and use it in GitHub Desktop.
A small jquery component switch widget.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var switchComponent = { | |
init : function(){ | |
var firstSwitch = ".swfirst"; | |
var secondSwitch = ".swsecond"; | |
var compContent = $(".componentscontent"); | |
var envContent = $(".environmentscontent"); | |
$(firstSwitch).click(function() { | |
$(this).css({background: '#eaefd8', color: '#000', borderRight: '2px solid #d6e1b4'}); | |
$(secondSwitch).css({background: '#e0e8c6', color: '#ccc', borderLeft: '2px solid #ccc'}); | |
$(compContent).hide(); | |
$(envContent).show(); | |
}); | |
$(secondSwitch).click(function() { | |
$(this).css({background: '#eaefd8', color: '#000', borderLeft: '2px solid #d6e1b4'}); | |
$(firstSwitch).css({background: '#e0e8c6', color: '#ccc', borderRight: 'none', borderRight: '2px solid #ccc'}); | |
$(compContent).show(); | |
$(envContent).hide(); | |
}); | |
} | |
} | |
$(document).ready(switchComponent.init); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment