A classic solution applied in such cases is to assign a css class (named
for example 'hashlinked') to the target element. The related css rule is
the following:
.hashlinked:before {
display: block;
content: " ";
height: 40px; /* the height of the element that hides the target */
visibility: hidden;
}
Put the above snippet in your custom css file or in the <style> tag in the
<head> section of layout.html.
Note also that the target element hasn't to be neccessary an anchor. So you
could write directly
<hi id="lorem" name="lorem" class="hashlinked">Lorem Section</h1>
and omit the anchor tag.
Of course there are other solution to the problem
Il giorno mercoledì 16 ottobre 2013 01:42:37 UTC+2, Carlos Hanson ha
scritto:
>
> Greetings,
>
> I have created an anchor that looks like the following:
>
> <a href="#lorem">Lorem Section</a>
> <a id="lorem" name="lorem"></a>
> <h1>Lorem Section</h1>
>
> After clicking on the link "Lorem Section", the anchor jumps to the top of
> the browser page, but that puts the header "Lorem Section" under the
> navbar. I would expect it to jump below the navbar.
>
> I am having difficulty finding a solution, so far. Has anyone else run
> into this problem and solved it?
>
> I've attached a simple app showing the problem.
>
> I am currently running version 2.5.1-stable+timestamp.2013.06.06.15.39.19.
>
> Thanks.
>
> Carlos Hanson
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.