/    Sign up×
Community /Pin to ProfileBookmark

<div> Text link without changing position on page?

Hello,

My problem is that I have a long list of [B]<a href>[/B] text link categories used in conjunction with [B]<div>[/B] tags, which reveal/hide a list of items for each category (small example of the code format is below). Is there any way I can keep the [B]<a class=”1″ href…>[/B] tag without meaning the page will link to the top of the page when you click on it? I think the problem is with the [B]“#”[/B], which automatically links to the top of the page and I’ve tried changing it to [B]“#bottom”[/B] but then it just links too low on the page. I just want the page to stay in exactly the same place when you click the [B]<a class=”1″ href…>[/B] link, which will reveal/hide the five [B]class=”3″[/B] links every time it’s clicked.

I considered using [B]<a name=”blah”></a>[/B] tags for each category but that wouldn’t give the desired effect (as it would make that particular category go to the top of the page, which I don’t want, because I don’t want the page to move at all when you click the link!). I also considered deleting the [B]<a class=”1″ href…>[/B] tag altogether and changing the [B]<div>[/B] parameters in the CSS, but I’m pretty sure it’s not possible to get the link rollover text effect with [B]<div>[/B] tags.

Can anyone help?


————————-

CODE:

<div onClick=”toggle(‘2’)”> [B]<a class=”1″ href=”#”>[/B]Ceramics[B]</a>[/B]</div>
<div id=”2″ style=”display:’none’;”>
<li><a class=”3″ href=”http://www.blahblah.com/main&page=L-1000″>L-1000</a></li>
<li><a class=”3″ href=”http://www.blahblah.com/main&page=L-1001″>L-1001</a></li>
<li><a class=”3″ href=”http://www.blahblah.com/main&page=L-1002″>L-1002</a></li>
<li><a class=”3″ href=”http://www.blahblah.com/main&page=L-1003″>L-1003</a></li>
<li><a class=”3″ href=”http://www.blahblah.com/main&page=L-1004″>L-1004</a></li>

</div>
————————-

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJan 17.2005 — Hi![i]Originally posted by Elton [/i]

I also considered deleting the [B]<a class="1" href...>[/B] tag altogether and changing the [B]<div>[/B] parameters in the CSS, but I'm pretty sure it's not possible to get the link rollover text effect with [B]<div>[/B][/QUOTE]
You could get the rollover effect using css but you'd need a workaround for IE which is a little bit dumb concerning 'hover'. For your a-tags, just use:

<a class="1" href="#" onclick="return false;">Ceramics</a>

Cheers - Pit
Copy linkTweet thisAlerts:
@EltonauthorJan 17.2005 — Thanks a lot, that's done the trick!!!
Copy linkTweet thisAlerts:
@PittimannJan 17.2005 — You're welcome! ?
×

Success!

Help @Elton spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...