Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. $('.corpo_buttons_asia').click(function() {
  2. $('.info').css('visibility', 'hidden');
  3. $('.info2').css('visibility', 'visible');
  4. $(this).css('z-index', '20');
  5. $(this).css('background-color', 'rgb(23,55,94)');
  6. $(this).css('color', '#FFF');
  7. $('.corpo_buttons_global').css('background-color', 'rgb(197,197,197)');
  8. $('.corpo_buttons_global').css('color', '#383838');
  9. });
  10.  
  11. $('.corpo_buttons_global').click(function() {
  12. $('.info').css('visibility', 'visible');
  13. $('.info2').css('visibility', 'hidden');
  14. $(this).css('background-color', 'rgb(23,55,94)');
  15. $(this).css('color', '#FFF');
  16. $('.corpo_buttons_asia').css('z-index', '2');
  17. $('.corpo_buttons_asia').css('background-color', 'rgb(197,197,197)');
  18. $('.corpo_buttons_asia').css('color', '#383838');
  19. });
  20.  
  21. $('.theclassthatstherenow').addClass('newclasswithyourstyles').removeClass('theclassthatstherenow');
  22.  
  23. $('.theclassthatstherenow').addClass('newclasswithyourstyles');
  24. $('.theclassthatstherenow').removeClass('theclassthatstherenow');
  25.  
  26. var el = document.querySelector('.theclassthatstherenow');
  27. el.classList.remove('theclassthatstherenow');
  28. el.classList.add('newclasswithyourstylerules');
  29.  
  30. var el = document.getElementsByClassName('theclassthatstherenow');
  31. el.className = el.className.replace(/s*theclassthatstherenows*/, ' newclasswithyourstylerules ');
  32.  
  33. (function ($) {
  34. $.fn.replaceClass = function (pFromClass, pToClass) {
  35. return this.removeClass(pFromClass).addClass(pToClass);
  36. };
  37. }(jQuery));
  38.  
  39. $('.divFoo').replaceClass('colored','blackAndWhite');
  40.  
  41. <div class="divFoo colored"></div>
  42.  
  43. <div class="divFoo blackAndWhite"></div>
  44.  
  45. .active {
  46. z-index: 20;
  47. background: rgb(23,55,94)
  48. color: #fff;
  49. }
  50.  
  51. $(this).addClass("active");
  52.  
  53. .greenclass {color:green;}
  54.  
  55. $('selector').addClass("green");
  56.  
  57. $('selector').removeClass("green");
  58.  
  59. $("#YourID").switchClass("old-class-here", "new-class-here");
  60.  
  61. jQuery.fn.replaceClass = function(sSearch, sReplace) {
  62. return this.each(function() {
  63. var s = (' ' + this.className + ' ').replace(' ' + sSearch.trim() + ' ', ' ' + sReplace.trim() + ' ');
  64. this.className = s.substr(1, s.length - 2);
  65. });
  66. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement