html - Moving a div from below another to above upon window resize -


i have 2 divs, , b. b under a. possible put above instead when resize window vertically narrow enough? can emulated hiding/showing divs based on size?

the issue you're talking broadly known responsive design.

sample code demonstrates possible solution problem shown below. uses resize event on window element, , hides chosen element, based on actual window width. redesign method should contain appropriate logic, designs view accordingly actual width:

$(document).ready(function () {     redesign();     $(window).resize(function(){         redesign();     }); });  function redesign(){     if ($(window).width() < 640) {         $("#diva").hide();     }else{         $("#diva").show();     } } 

look @ jsfiddle sample (obviously resize window see results). if you're interested in moving dom elements in relationship each other, check jquery insertbefore method.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -