SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Enlargin Div

  1. #1
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Enlargin Div

    Hi Folks,

    Using JavaScript, how do I enlarge a div in Height upon an image being clicked?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2007
    Location
    Virginia
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <html>
    <head>
    <title>test</title>
    <script language="javascript" type="text/javascript">
    function set_new_height() {
    	var newHeight = 500 + 'px';
    	document.getElementById('content').style.height = newHeight;
    }
    </script>
    </head>
    <body>
    <a href="#" onClick="set_new_height()"> click me to enlarge div </a>
    <div id="content" style="border:1px solid black;background:blue;padding:20px;color:white;padding:20px;"> this<br>
      is<br>
      dynamic<br>
      lol </div>
    </div>
    </body>
    </html>
    Mark A. Drake
    - Mark A. Drake
    - OnSlaught

  3. #3
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Enlarging Div

    markusmad,

    Is it possible to scroll the div larger, so it enlarges gradually?
    Also, is it possible to scroll the div smaller, upon clicking a different link?


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
  •