Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $("#loginSelector").mouseenter(function() {
- if $("#loginSelector").style.backgroundColor != "#3064CA" {
- $("#loginSelector").style.backgroundColor = "#3064CA";
- };
- });
- $("#loginSelector").mouseleave(function() {
- if $("#loginSelector").style.backgroundColor != "#5990DE" {
- $("#loginSelector").style.backgroundColor = "#5990DE";
- };
- });
- $("#signupSelector").mouseenter(function() {
- if $("#signupSelector").style.backgroundColor != "#3064CA" {
- $("#signupSelector").style.backgroundColor = "#3064CA";
- };
- });
- $("#signupSelector").mouseleave(function() {
- if $("#signupSelector").style.backgroundColor != "#5990DE" {
- $("#signupSelector").style.backgroundColor = "#5990DE";
- };
- });
- });
- $("#loginSelector").mouseenter(function() { //when hovered on
- var desiredColor = "#3064CA"; //define the desired color
- if ( $(this).css('color') === desiredColor) return; //if the element's color = the desired color, don't do anything. stop the execution
- $(this).css('color', desiredColor); //else set the desired color
- });
- #loginSelector, #signupSelector{
- background: #5990DE;
- }
- #loginSelector:hover, #signupSelector:hover{
- background: #3064CA;
- }
- .onHover{
- background: #3064CA;
- }
- .onLeave{
- background: #5990DE;
- }
- $(document).on('mouseenter', 'loginSelector , #signupSelector', function(){
- $(this).addClass('onHover').removeClass('onLeave');
- });
- $(document).on('mouseleave', '#loginSelector , #signupSelector', function(){
- $(this).addClass('onLeave').removeClass('onHover');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement