html - Move objects with jquery depending on resize and/or load -


i have navigation bar placed after header on website.

i'd move object right after opening body tag if user resizes window less 768px, return it's original position if make browser wider amount.

the navigation bar loading in correct place if page loads depending on browser width, want working on resize well.

any suggestions?

the code have basic far…

jquery(document).ready(function ($) {     var width = window.innerwidth || document.documentelement.clientwidth;     if (width < 768) {         $('#custommenu').prependto('body');     } }); // end:jquery(document).ready(function(){ 

i'm not sure if understand if want trigger function on resize event can use:

$(window).on('resize', function() {     var winwidth = $(window).width();     if (winwidth < 768) {         $('#custommenu').prependto('body');     } else {         $('#custommenu').prependto('#somewhereelse');     } }); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -