SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2007
    0 Post(s)
    0 Thread(s)

    displaying content if javascript is disabled

    Hi there,

    I have a jQuery banner slider, but I would like to know if it is possible to display different content (or the first slide only), if JavaScript is disabled.

    This is my content:

    <div id="slider">
          <ul id="slider1">
            <!-- slide #1 -->
              <h1>my heading</h1>
              <h2>sub heading</h2>
                  <p>slide content</p>
            <!-- end slide #1 --> 
            <!-- slide #2 -->
              <h1>my heading</h1>
              <h2>sub heading</h2>
                  <p>slide content</p>
            <!-- end slide #2 -->
    Any help would be great! Thanks

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Sydney, NSW, Australia
    25 Post(s)
    1 Thread(s)
    To have content that displays if JavaScript is disabled you simply include it in the page to start with. You then hide it using JavaScript. If JavaScript is disabled then the code to hide it doesn'tr run and that content remains visible.

    You can also do it with blocks of content by wrapping the block in <noscript> tags but using JavaScript is more lfexible as you can update inline content rather than just blocks as well as testing that the JavaScript commands your script uses are available.
    Stephen J Chapman, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts