jquery - Dynamic javascript function -
this question has answer here:
- javascript window resize event 11 answers
i have javascript function want execute if browser screen bigger 1024px.
if ($(window).width() > 1024) {
the problem code if user first load webpage in browser screen 800px , rescale browser screen 1024 (or more) function not executed. in order executed screen needs refreshed.
do have suggestion how fix it?
$(document).ready(function() { if ($(window).width() > 1024) { my_awesome_window_above1024_function(); } }); $(window).resize(function() { if ($(window).width() > 1024) { my_awesome_window_above1024_function(); } });
Comments
Post a Comment