Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Richard Feinburg
2,970 PointsMedia Query and CSS
Not good at jQuery/Javascript and can't this javascript to work. I know I'm reading it wrong. Trying to hide a DIV when under 760px for a menu. What Im I doing wrong?
<script language="javascript">
$(document).ready(function() {
$('#company-button').click(function() {
$('.company-list').toggle("fade");
});
if ($(window).width() < 760){
if ($('.company-list').css('display') == "none" ){
}
}
});
</script>
3 Answers

Richard Feinburg
2,970 PointsI got it!
<script language="javascript">
$(document).ready(function() {
$('#company-button').click(function() {
$('.company-list').toggle("fade");
});
if ($(window).width() < 760){
$(".company-list").css("display", "none");
}
});
</script>

Thiago Xavier
783 PointsHi Richard, try tu use only css3 media queries, remove your if statement and put this in your css:
@media all and (max-width:760px) {
.company-list {
display:none;
}
}
it should work!

Paulo Aguiar
14,120 PointsAgreed, this type of thing is much simpler as a media query.