As far as I can tell I have set up my jQuery so that it removes some elements when the window gets too small and puts them back when it gets larger again. Without the code that appends the elements, they remove themselves fine. But with the append code they never disappear. In addition, the jQuery window.width() seems to be different than that of my css media queries. Thanks in advance.
Here is my jQuery:
$(window).resize(function () {
if ($(window).width() < 719) {
$("#logo").remove();
$("nav").remove();
}
else if($(window).width() > 719) {
$("header").append("<nav>
<ul>
<li><a href = 'index.php' class='<?php if ($section == 'About') { echo 'selected'; }?>'>About</a></li>
<li class = 'greyed-out'>/</li>
<li><a href = 'work.php' class='<?php if ($section == 'Work') { echo 'selected'; } ?>''>Work</a></li>
<li class = 'greyed-out'>/</li>
<li><a href = 'contact.php' class='<?php if ($section == 'Contact') { echo 'selected'; } ?>''>Contact</a></li>
</ul>
</nav>");
//<div id = "logo"><img src = "img/logo.png"></div>
}
});
Here are my media queries. I had to fiddle around with the jQuery widths in my if statement to get the elements to disappear and corresponding styling to be applied roughly at the same time (719 px != 738):
@media(min-width: 1250px) {
#skills-container {
margin-left: auto;
margin-right: auto;
max-width: 810px;
}
}
@media(max-width: 738px) {
html {
width: 100%;
background-image: none;
border: none;
}
.wrapper {
width: 100%;
margin-left: 0;
}
.page-section, footer {
width: 98%;
margin-left: 1%;
}
header {
width: 100%;
margin: 0;
background-color: #00bf8a;
}
}