SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Hide Div and Show Div Using javascript and jquery in css

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Location
    Aurangabad
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hide Div and Show Div Using javascript and jquery in css

    hi everyone
    I have created one web page for website, these having four main Div but i have to do Show Div and Hide some Div using javascript or jquery in css.

    Four main Div are:-

    1) header
    2) banner
    3) Content
    4)footer

    :- on the website two div hide content and footer these two div are hidden when user open the website.

    :- And header and banner not hidden these two div are displaying data on website, the website width:- 960 and height:- 650, but should it work same in all major browser
    and one thing also in mind how to solve the height issue on basis of moniter configuration.

    :- on header having menu navigation button after click button's, content and footer div should be display or show on the bottom of the header div and banner div should be hide/hidden.

  2. #2
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,438
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi,

    I've just read and re-read your post, but I couldn't find a question in there.
    What is it exactly you are having trouble with?
    It would be helpful to know what you have tried so far, and for you to provide a sample of code which encapsulates the problem.

    Please also be aware that asking for someone to make your site for you, almost always leads to your post being ignored.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    15,815
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You can easily hide and show divs from JavaScript simply by having the JavaScript update either the display or visibility attribute for the div in the CSS.

    for example:

    <div id="content">

    and then either

    document.getElementById('content').style.visibility = 'hidden'; // to hide but retain the space
    document.getElementById('content').style.visibility = 'visible'; // to show again

    or

    document.getElementById('content').style.display = 'none'; // to hide completely
    document.getElementById('content').style.display = 'block';// to show again reclaiming the space

    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Location
    Aurangabad
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank's for answering

Bookmarks

Posting Permissions

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