File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes shrinking a div vertically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "shrinking a div vertically" Watch "shrinking a div vertically" New topic
Author

shrinking a div vertically

Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
There are two divs say, and based on a particular condition, my second div should be shown.
Say if some condition is true ,
then display both the divs,


and if the condition is false,
then shrink the page to display only the first div.

I want to know how can we shrink the page to display only first div


Man Suraj
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61193
    
  66

You don't "shrink" the page, you hide the div.

HTML elements can be hidden and show by adjusting the CSS display property.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
Is there anyway using jquery methods like hide or something?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61193
    
  66

Well, of course. (How do you think jQuery does it?)


To hide an element with an id of fred:to make it visible:
Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
but what if i have to first test a condition and then decide to show the div or not?

can i mix the tags and java script. What i mean by this is,can i do something like below?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61193
    
  66

Of course not. Server-side decisions need to be made in a server-side manner. Just set the CSS when it's a server-side decision. JavaScript or jQuery come into play for client-side decisions.
Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
could you please elaborate a little more on what you said..specially the lne below

Just set the CSS when it's a server-side decision
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: shrinking a div vertically