Stylegala Forums » Forums list » Problem solving
open a div on click
open a div on click
Goto page 1, 2 Next
Post new topic
Reply to topic
| Author | Message |
|---|---|
Lost_User
|
Hope the title explains the basics ! I want to open/show a layer/div with a click on a link. Is this possible, looked at open browser window but looks a bit chunky. Amateur at the web so I may be asking the obvious !
regards gordonw |
| Sponsor | |
Lost_User
|
Not sure these are best ways... just a couple that I know of.
http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm - and - http://moofx.mad4milk.net/tests.html Click on toggle height or toggle width, repeated clicking opens then closes the div, these are cool and maybe more advanced. Both of these use javascript, maybe there's a way to do it without the jS? Here's another from Apple: http://developer.apple.com/internet/webcontent/hideshow_layer.html Towards the bottom of the page there's links to some examples... these look to be similar to what some would call a tooltip popup... you'ld also find examples of these at dynamic drive. |
Lost_User
|
down and dirty works.. man TzMedia he said he was a noob, and you sent him to links that intermediate and advanced folks would rub thier forheads at :) not the mooFX link thats a pretty straight forward one. but dynamicdrive??/ lol Iused to usethem a while ago, that link brought back old memories. anyway you could use this attached in an external js document or writte onthe page and call it by
onclick="toggle('yourIDname');"
|
Lost_User
|
Here is what I am using:
function toggle(id){ if (document.getElementById){ var el = document.getElementById(id); el.style.display = (el.style.display == 'none') ? 'block' : 'none'; } } And if you want the div to be hidden by default just add this to the Javascript: window.onload = function(){ toggle('your-div-id-here'); } Of course you would change 'your-div-id-here' to the id of the div you want to hide. And here is what you put in your HTML: <a href="#" onclick="toggle('your-div-id-here')" title="A title if you want or need one">Link01</a> or <a href="javascript:toggle('your-div-id-here')" title="A title if you want or need one">Link01</a> and you could always add more divs that do the same thing just by calling the toggle with a different id. |
Lost_User
|
Thanks for the help gents - eventually went with Joshua Kendalls, after my son explained how it worked !
Regards gordonw |
Lost_User
|
Have you got a link to see it in action ... that'ld be great?
Thanks... glad you found something then. |
Lost_User
|
hmmmmmm. what was the difference between what Kendall gave you and what I gave you? |
Lost_User
|
hmmmmmm. what was the difference between what Kendall gave you and what I gave you? You tell me, all was most appreciated, take note from my initial question 'amateur' and my first thanks 'after my son explained how it worked !' again thanks for the help... regards gordonw |
clemi
|
climaxdesigns wrote:
hmmmmmm. what was the difference between what Kendall gave you and what I gave you? They do the same thing, but Joshua's use of a 'ternary conditional' is simply a more efficient way of peforming the check and returning the appropriate output. |
Lost_User
|
Bill
You about 30 with a degree in computer science, sound very like my son! I do this for fun ! Ternary sounds like some medical condition :-) gordonw |
Goto page 1, 2 NextPage 1 of 2
Powered by phpBB. © 2001, 2006 phpBB Group & Logo Design
