I am using a little bit of jQuery I wrote (I'm not too good with JavaScript/jQuery) that adds/removes a div (in this case, .show500, .hide500) on a browser resize. Here is the code:
//Completely add/remove divs completely from DOM on browser resize
        $(function(){
            $(window).resize(function(){
                var win = $(this); //this = window
                if (win.width() <= 500) { 
                    $('.show500').add();
                    $('.hide500').remove();
                } else if (win.width() > 500) { 
                    $('.hide500').add();
                    $('.show500').remove();
                }
            });
        });
So if the browser window is less than or equal to 500, add the .show500 into the DOM, and remove the .hide500 from the DOM.
Then, if the browser width is greator than 500, add the .hide500 into the DOM, and remove the .show500 from the DOM.
However, when I use this code, the .hide500 div shows up by default, and then when I shrink the browser size, the .hide500 div hides and the .show500 never shows up. Then when I expand the browser, both of the divs are gone.
Here is a jsFiddle of the code: http://jsfiddle.net/XzrPR/
I would appreciate any and all help from you guys!



.add()does? Did you look it up? Here - api.jquery.com/add . You probably want to be using.hide()and.show(). The.remove()will (permanently) remove the element(s) from the page, so you wouldn't be able to show them later anyways.