After writing a simple JQuery code, I noticed that every time I click on 'eat', the animation lags. Is there any way to preload this animation for smoother performance?
The #custom_menu
element is a full-page section with a fixed position (similar to a popup window).
$('.eat').click(function(){
$('#menu').css('opacity', '0');
$('#custom_menu').css("display", "block").hide().fadeIn(500);
$('#custom_menu').css("overflow-y", "scroll");
$('body').css("overflow-y", 'hidden');
});