Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Toggling visibility in css, not javascript

Reply
Thread Tools

Re: Toggling visibility in css, not javascript

 
 
cwdjrxyz
Guest
Posts: n/a
 
      08-05-2008
On Aug 4, 1:23*pm, Chris <(E-Mail Removed)> wrote:
> Is there a way that I can toggle the visibility of a div on and off
> using css alone? It's a bit inconvenient in our app to use javascript here.
>
> Googling around, I found two tricks, neither of which quite does it. One
> toggles visibility on hover, and the other creates a dummy checkbox,
> styles it so it doesn't look like a checkbox, and then has different
> styles for the checked/unchecked states. Clever, but it's hard to use
> checkboxes like this in our app.
>
> I'm thinking the challenge here is to maintain state using css alone.
> Probably not possible, but thought I'd ask.


As others have indicated, it seems you can do this with css alone
without JavaScript and have your code work as intended on most popular
current browsers.

If you can use php on your server, it is likely you could do this
server side with php. It quite often is possible to do the same thing
with php server side as it is to do it with JavaScript on the browser.
And you usually do not have to worry about the response of different
browsers and if the viewing browser has script turned on or off. I do
not know the details of your code, but I have used php to turn
visibility on and off on some of my pages.
 
Reply With Quote
 
 
 
 
cwdjrxyz
Guest
Posts: n/a
 
      08-05-2008
On Aug 4, 8:26*pm, cwdjrxyz <(E-Mail Removed)> wrote:
> On Aug 4, 1:23*pm, Chris <(E-Mail Removed)> wrote:
>
> > Is there a way that I can toggle the visibility of a div on and off
> > using css alone? It's a bit inconvenient in our app to use javascript here.

>
> > Googling around, I found two tricks, neither of which quite does it. One
> > toggles visibility on hover, and the other creates a dummy checkbox,
> > styles it so it doesn't look like a checkbox, and then has different
> > styles for the checked/unchecked states. Clever, but it's hard to use
> > checkboxes like this in our app.

>
> > I'm thinking the challenge here is to maintain state using css alone.
> > Probably not possible, but thought I'd ask.

>
> As others have indicated, it seems you can do this with css alone
> without JavaScript and have your code work as intended on most popular
> current browsers.
>
> If you can use php on your server, it is likely you could do this
> server side with php. It quite often is possible to do the same thing
> with php server side as it is to do it with JavaScript on the browser.


The above should read:
"As others have indicated, it seems you can not do this with css alone
without JavaScript and have your code work as intended on some popular
current browsers." - sorry


> And you usually do not have to worry about the response of different
> browsers and if the viewing browser has script turned on or off. I do
> not know the details of your code, but I have used php to turn
> visibility on and off on some of my pages.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggling back and forth between two tabs (not Ctrl+Tab). John Doe Firefox 0 10-10-2008 07:12 PM
Re: Toggling visibility in css, not javascript richard HTML 3 08-06-2008 07:04 AM
Re: Toggling visibility in css, not javascript C A Upsdell HTML 2 08-05-2008 12:23 AM
Toggling Image =?Utf-8?B?c2lhag==?= ASP .Net 1 05-06-2005 10:45 AM
nested repeaters with javascript for checkbox toggling Machi ASP General 1 04-15-2004 11:55 AM



Advertisments