Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. $(document).ready(function() {
  2. $("#loginSelector").mouseenter(function() {
  3. if $("#loginSelector").style.backgroundColor != "#3064CA" {
  4. $("#loginSelector").style.backgroundColor = "#3064CA";
  5. };
  6. });
  7.  
  8. $("#loginSelector").mouseleave(function() {
  9. if $("#loginSelector").style.backgroundColor != "#5990DE" {
  10. $("#loginSelector").style.backgroundColor = "#5990DE";
  11. };
  12. });
  13.  
  14. $("#signupSelector").mouseenter(function() {
  15. if $("#signupSelector").style.backgroundColor != "#3064CA" {
  16. $("#signupSelector").style.backgroundColor = "#3064CA";
  17. };
  18. });
  19.  
  20. $("#signupSelector").mouseleave(function() {
  21. if $("#signupSelector").style.backgroundColor != "#5990DE" {
  22. $("#signupSelector").style.backgroundColor = "#5990DE";
  23. };
  24. });
  25. });
  26.  
  27. $("#loginSelector").mouseenter(function() { //when hovered on
  28. var desiredColor = "#3064CA"; //define the desired color
  29. if ( $(this).css('color') === desiredColor) return; //if the element's color = the desired color, don't do anything. stop the execution
  30. $(this).css('color', desiredColor); //else set the desired color
  31. });
  32.  
  33. #loginSelector, #signupSelector{
  34. background: #5990DE;
  35. }
  36. #loginSelector:hover, #signupSelector:hover{
  37. background: #3064CA;
  38. }
  39.  
  40. .onHover{
  41. background: #3064CA;
  42. }
  43. .onLeave{
  44. background: #5990DE;
  45. }
  46.  
  47. $(document).on('mouseenter', 'loginSelector , #signupSelector', function(){
  48. $(this).addClass('onHover').removeClass('onLeave');
  49. });
  50. $(document).on('mouseleave', '#loginSelector , #signupSelector', function(){
  51. $(this).addClass('onLeave').removeClass('onHover');
  52. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement