I’m working with jQuery .resize() method. I would like to change the html within a div “logoTitleHtml when the browsers width is changed. The HTML in the div does change when the browser is refreshed but does not do so when it is not which is causing a scroll bar at the bottom of my site when the width is less than or equal to 499px in width.
How can I make jQuery detect and change the HTML without having to manually refresh the page (which is a horrible user experience)? I’m not opposed to using other JS Frameworks that will make this easier to accomplish.
Thank You.
This is my current code:
[code]
var windowSize = jQuery(window).width(),
logoTitle = jQuery(“.logo-contents”);
jQuery(window).resize(function(){
if (windowSize <= 499) {
logoTitle.html(“So.. WYGD?”);
}else (windowSize >= 500) {
logoTitle.html(“So.. What You Gonna Do?”);
}
});