The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design Selective #include file loaded based on screen width.

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #188362

    I just posted a problem in the JavaScript Jungle in which I described my problem poorly. I put the problem there because I was trying to use JavaScript to solve my problem.

    Here is a better way to describe my problem.
    What I want to do is to have one of the two #include statements selected based on the screen width of 1280 pixels and 1024 pixels.

    If the screen width is 1280 or wider I want the first statement to be executed. if the width is 1024 or less , I want the second statement to be executed.

    I have included the extra “banner” and “content” code so it is obvious where this is on my web page.

    <div id="page">
        <!--#include file="includes/nav.html" -->
        <!--#include file="includes/nav2.html" -->
    <div id="banner">
        <!--#include file="includes/banner.html" -->
    </div><!-- end banner-->
    <div id="content">

    In other words, what I want is something like this. But obviously I need code that works.

    if screen width > 1025 px do this:
    <!--#include file="includes/nav.html" -->
    else do this:
    <!--#include file="includes/nav2.html" -->

    Is there a way to do this?

Viewing 1 post (of 1 total)
  • The forum ‘Design’ is closed to new topics and replies.