Created
January 4, 2021 11:01
-
-
Save yousufansa/512e2fc5773b23b5ab1519b697540b70 to your computer and use it in GitHub Desktop.
Front - Slick Width Issue Inside Bootstrap Tab Fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( ! function_exists( 'front_child_slick_inside_tab_width_issue_fix_script' ) ) { | |
function front_child_slick_inside_tab_width_issue_fix_script() { | |
ob_start(); ?> | |
(function ($) { | |
"use strict"; | |
$(document).ready(function () { | |
$('a[role="tab"]').on('shown.bs.tab', function (e) { | |
$('.js-slick-carousel').slick('setPosition'); | |
}) | |
}); | |
})(jQuery); | |
<?php | |
$custom_script = ob_get_clean(); | |
wp_add_inline_script( 'front-scripts', $custom_script ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'front_child_slick_inside_tab_width_issue_fix_script', 30 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment