Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/58c80a6aebdde4db5f50fe123c21c940 to your computer and use it in GitHub Desktop.
Save xlplugins/58c80a6aebdde4db5f50fe123c21c940 to your computer and use it in GitHub Desktop.
Collapsible order summary on mobile open on first load and then can close on click
add_action( 'wfacp_internal_css', 'exute_custom_aero_js' );
function exute_custom_aero_js() {
?>
<style>
@media (min-width: 992px)and (max-width: 1366px) {
.wfacp_collapsible_order_summary_wrap.wfacp_tablet.wfacp_mobile {
display: none;
}
}
</style>
<script>
window.addEventListener('DOMContentLoaded', function () {
(function ($) {
var width = $(window).width();
collpaseOrderSummary(width);
$(window).on("orientationchange", function () {
setTimeout(function () {
var width = $(window).width();
collpaseOrderSummary(width);
}, 500);
});
function collpaseOrderSummary(width) {
$('.wfacp_mb_mini_cart_sec_accordion_content').addClass('wfacp_display_none');
console.log(width);
if (width <= 768 ) {
if ($('.wfacp_mb_mini_cart_sec_accordion_content').length > 0) {
$('.wfacp_mb_mini_cart_sec_accordion_content').removeClass('wfacp_display_none');
}
}
}
})(jQuery);
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment