init.js 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. jQuery( function ( $ ) {
  2. 'use strict';
  3. // here for each comment reply link of WordPress
  4. $( '.comment-reply-link' ).addClass( 'btn btn-primary' );
  5. // here for the submit button of the comment reply form
  6. $( '#commentsubmit' ).addClass( 'btn btn-primary' );
  7. // The WordPress Default Widgets
  8. // Now we'll add some classes for the WordPress default widgets - let's go
  9. // the search widget
  10. $( '.widget_search input.search-field' ).addClass( 'form-control' );
  11. $( '.widget_search input.search-submit' ).addClass( 'btn btn-default' );
  12. $( '.variations_form .variations .value > select' ).addClass( 'form-control' );
  13. $( '.widget_rss ul' ).addClass( 'media-list' );
  14. $( '.widget_meta ul, .widget_recent_entries ul, .widget_archive ul, .widget_categories ul, .widget_nav_menu ul, .widget_pages ul, .widget_product_categories ul' ).addClass( 'nav flex-column' );
  15. $( '.widget_meta ul li, .widget_recent_entries ul li, .widget_archive ul li, .widget_categories ul li, .widget_nav_menu ul li, .widget_pages ul li, .widget_product_categories ul li' ).addClass( 'nav-item' );
  16. $( '.widget_meta ul li a, .widget_recent_entries ul li a, .widget_archive ul li a, .widget_categories ul li a, .widget_nav_menu ul li a, .widget_pages ul li a, .widget_product_categories ul li a' ).addClass( 'nav-link' );
  17. $( '.widget_recent_comments ul#recentcomments' ).css( 'list-style', 'none').css( 'padding-left', '0' );
  18. $( '.widget_recent_comments ul#recentcomments li' ).css( 'padding', '5px 15px');
  19. $( 'table#wp-calendar' ).addClass( 'table table-striped');
  20. // Adding Class to contact form 7 form
  21. $('.wpcf7-form-control').not(".wpcf7-submit, .wpcf7-acceptance, .wpcf7-file, .wpcf7-radio").addClass('form-control');
  22. $('.wpcf7-submit').addClass('btn btn-primary');
  23. // Adding Class to Woocommerce form
  24. $('.woocommerce-Input--text, .woocommerce-Input--email, .woocommerce-Input--password').addClass('form-control');
  25. $('.woocommerce-Button.button').addClass('btn btn-primary mt-2').removeClass('button');
  26. $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
  27. event.preventDefault();
  28. event.stopPropagation();
  29. $(this).parent().siblings().removeClass('open');
  30. $(this).parent().toggleClass('open');
  31. });
  32. // Fix woocommerce checkout layout
  33. $('#customer_details .col-1').addClass('col-12').removeClass('col-1');
  34. $('#customer_details .col-2').addClass('col-12').removeClass('col-2');
  35. $('.woocommerce-MyAccount-content .col-1').addClass('col-12').removeClass('col-1');
  36. $('.woocommerce-MyAccount-content .col-2').addClass('col-12').removeClass('col-2');
  37. // Add Option to add Fullwidth Section
  38. function fullWidthSection(){
  39. var screenWidth = $(window).width();
  40. if ($('.entry-content').length) {
  41. var leftoffset = $('.entry-content').offset().left;
  42. }else{
  43. var leftoffset = 0;
  44. }
  45. $('.full-bleed-section').css({
  46. 'position': 'relative',
  47. 'left': '-'+leftoffset+'px',
  48. 'box-sizing': 'border-box',
  49. 'width': screenWidth,
  50. });
  51. }
  52. fullWidthSection();
  53. $( window ).resize(function() {
  54. fullWidthSection();
  55. });
  56. // Allow smooth scroll
  57. $('.page-scroller').on('click', function (e) {
  58. e.preventDefault();
  59. var target = this.hash;
  60. var $target = $(target);
  61. $('html, body').animate({
  62. 'scrollTop': $target.offset().top
  63. }, 1000, 'swing');
  64. });
  65. });