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

JavaScript

Edit Theme

I'm using This theme to create a website for a family member. The problem I am having is the theme defaults to "wide" and I want it to be "boxed". You can see the style switcher to the left (click on cog). I found this in the .JS file. Does anyone know how to make this template stay in the boxed format by looking at this script? Thanks.

//Layout Switcher
    $(".layout-style").change(function(){
        if( $(this).val() == 1){
            $("#container").removeClass("boxed-page"),
            $(window).resize();
        } else{
            $("#container").addClass("boxed-page"),
            $(window).resize();
        }
    });

5 Answers

The only thing that script does is add or remove that the boxed-page class. If you're using their stylesheets, you should be able to just add class = "boxed-page" to the #container div in your html file:

index.html
<body>
  <!-- Full Body Container -->
  <div id="container" class="boxed-page">
    <!-- The rest of your stuff -->
    ...
  </div>
</body>

You're a genius...thanks.

Looking at it further, you might want to make a slight change to it yourself. The boxed-page adds a width of 1220px. The media query is set for 991px. So on screens between 992px and 1219px, you're getting a vertical horizontal scrollbar. Vertical Horizontal scrollbars suck (at least in my opinion, haha). Easiest fix would be to just make it a max-width: 1220px;

Your javascript code only add or remove a CSS class on your #container div. You need to write the CSS code for the .boxed-page class.

After looking into it more I'm not sure the style switcher has anything to do with it...the theme defaults to wide and I just want to make it boxed. Help still needed.

Hey Colin, do you mean a Horizontal scroll bar? I get a vertical scroll bar no matter what I do.

Yeah, haha. Sorry. Kind of hard to avoid vertical scrollbars. I should probably pay closer attention to what I'm writing when giving advice.

Thanks for the help...