Close Bootstrap modal with jQuery or Javascript on windows resize -


how can close bootstrap modal if browser windows width less 700px? have tried jquery this:

$(window).resize(function() {   if ($(window).width() < 700) {      $("#modal").hide( 0, function() {});     $("body").removeclass("modal-open");     $(".modal-backdrop").hide( 0, function() {});  } }); 

i have content of modal in 50% of page , when window less 700px content moves modal. working great if resize windows method above have problems , have press button open modal twice. if dont resize windows , close modal x works great have find way close modal when windows resized.

i believe should try

$('#modal').modal('hide'); 

instead of

$('#modal').hide(); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -