Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. // assets/scripts/customizer.js
  2.  
  3. (function($) {
  4.  
  5. // Primary colour
  6. wp.customize('primary_colour', function(value) {
  7. value.bind(function(to) {
  8. $('head').append('<style>.Primary-bg-c{background-color:'+ to +' !important;}</style>');
  9. $('head').append('<style>.Primary-c{color:'+ to +' !important;}</style>');
  10. $('head').append('<style>.Primary-c--hover:hover{color:'+ to +' !important;}</style>');
  11. $('head').append('<style>.Primary-bo-c{border-color:'+ to +' !important;}</style>');
  12. });
  13. });
  14.  
  15. // Secondary colour
  16. wp.customize('secondary_colour', function(value) {
  17. value.bind(function(to) {
  18. $('head').append('<style>h2::before{background:'+ to +' !important;}</style>');
  19. $('head').append('<style>.Breakout-text::before,.Breakout-text::after{color:'+ to +' !important;}</style>');
  20. $('head').append('<style>.Breakout-text::before,.Breakout-text::after{color:'+ to +' !important;}</style>');
  21. });
  22. });
  23.  
  24. // Header background colour
  25. wp.customize('header_background_colour', function(value) {
  26. value.bind(function(to) {
  27. $('head').append('<style>.Header{background-color:'+ to +' !important;}</style>');
  28. $('head').append('<style>#shiftnav-main{background-color:'+ to +' !important;}</style>');
  29. });
  30. });
  31.  
  32. // Header font colour
  33. wp.customize('header_font_colour', function(value) {
  34. value.bind(function(to) {
  35. $('head').append('<style>.Header a{color:'+ to +' !important;}</style>');
  36. $('head').append('<style>.shiftnav ul.shiftnav-menu li.menu-item > .shiftnav-target {color:'+ to +' !important;}</style>');
  37. });
  38. });
  39.  
  40. // Mobile menu hover colour
  41. wp.customize('mobile_menu_hover_colour', function(value) {
  42. value.bind(function(to) {
  43. $('head').append('<style>.shiftnav ul.shiftnav-menu li.menu-item > .shiftnav-target:hover {background-color:'+ to +' !important;}</style>');
  44. });
  45. });
  46.  
  47. // Footer background colour
  48. wp.customize('footer_background_colour', function(value) {
  49. value.bind(function(to) {
  50. $('head').append('<style>.Footer {background-color:'+ to +' !important;}</style>');
  51. });
  52. });
  53.  
  54. // Footer font colour
  55. wp.customize('footer_font_colour', function(value) {
  56. value.bind(function(to) {
  57. $('head').append('<style>.Footer {color:'+ to +' !important;}</style>');
  58. $('head').append('<style>.Footer .icon path {fill:'+ to +' !important;}</style>');
  59. });
  60. });
  61.  
  62. // Address
  63. wp.customize('address', function(value) {
  64. value.bind(function(to) {
  65. $('.Footer-contactDetails address').html(to);
  66. });
  67. });
  68.  
  69. // Phone number
  70. wp.customize('phonenumber_humans', function(value) {
  71. value.bind(function(to) {
  72. $('#js-phoneNumber').html(to);
  73. });
  74. });
  75.  
  76. // Email address
  77. wp.customize('email_address', function(value) {
  78. value.bind(function(to) {
  79. $('#js-emailAddress').html(to);
  80. });
  81. });
  82.  
  83.  
  84. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement