Re: :target which is not jumped to
- From: dorayme <doraymeRidThis@xxxxxxxxxxxxxxx>
- Date: Wed, 25 Feb 2009 09:18:11 +1100
In article <hbf.20090224hd0d@xxxxxxxxxxxxx>,
Hallvard B Furuseth <h.b.furuseth@xxxxxxxxxxx> wrote:
dorayme <doraymeRidThis@xxxxxxxxxxxxxxx> writes:
Hallvard B Furuseth <h.b.furuseth@xxxxxxxxxxx> wrote:
I've just discovered the :target trick to make a javascript-less
collapsable list, but I don't want the browser window to move when
the user clicks on a list item.
<style type=text/css> div:not(:target) > .hide { display:none } </style>
<div id=foo><a href=#foo>foo</a> <span class=hide>bla bla</span></div>
<div id=bar><a href=#bar>bar</a> <span class=hide>bla bla</span></div>
...
How about this sort of thing:
<http://dorayme.netweaver.com.au/one_two_three/one.php>
Multiple pages don't scale well. Lots of almost-equal pages with
just a few lines of difference (the item being "unhidden").
Oh well, I guess a little JavaScript isn't the end of the world..
Perhaps you are not noticing - because I have been badly remiss in not
explaining - that these pages are being delivered with server side
scripting. This means in this case that all the pages are in fact "the
same", "template-like". Except for one small identifying feature (which
can be dispensed with, ask at a PHP ng).
All the pages above are the same and read:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Title</title>
<style type="text/css">
span {display:none;}
div#currentpage span {display: inline; visibility: visible;}
div#currentpage a {display: none;}
</style>
</head>
<body>
<div<?php if ($thisPage=="one")
echo " id=\"currentpage\""; ?>><a href="one.php">one</a><span>
blah blah blah</span></div>
<div<?php if ($thisPage=="two")
echo " id=\"currentpage\""; ?>><a href="two.php">two</a><span>
blah blah blah</span></div>
<div<?php if ($thisPage=="three")
echo " id=\"currentpage\""; ?>><a href="three.php">three</a><span>
blah blah blah</span></div>
</body>
</html>
except with like
<?php $thisPage="one"; ?>
thrown in above the doctype.
So, I am giving you a way to do it without JS, with server side script.
--
dorayme
.
- Follow-Ups:
- Re: :target which is not jumped to
- From: David Stone
- Re: :target which is not jumped to
- References:
- :target which is not jumped to
- From: Hallvard B Furuseth
- Re: :target which is not jumped to
- From: dorayme
- Re: :target which is not jumped to
- From: Hallvard B Furuseth
- :target which is not jumped to
- Prev by Date: Re: what constitutes "good" CSS layout?
- Next by Date: Re: what constitutes "good" CSS layout?
- Previous by thread: Re: :target which is not jumped to
- Next by thread: Re: :target which is not jumped to
- Index(es):
Relevant Pages
|