I have the following code:-
if(jQuery(window).width() <= 992) {
$('#menu-main-menu').prepend('<a id="book-now-menu" href="https://bookings.planetbouncetrampolinepark.com/JumpBookings/BookSession.aspx?site=1&group=1">BOOK NOW</a>');
var social_menu = '<div id="social-menu">';
social_menu += '<a href="" target="_blank"><span class="icon-social icon-facebook"></span></a>';
social_menu += '<a href="" target="_blank"><span class="icon-social icon-instagram"></span></a>';
social_menu += '<a href="" target="_blank"><span class="icon-social icon-twitter"></span></a>';
social_menu += '<a href="" target="_blank"><span class="icon-social icon-youtube"></span></a>';
social_menu += '</div>';
$('#menu-main-menu').append(social_menu);
}
This works fine when you refresh the page at below 992px or greater than than 992px. But in terms of responsiveness, it will either attach the code based on what your initial browser width is. Is there a way to get round this so that it detects the browser width on change and will either add/remove the above code?
Thanks in advance.