Thanks. That works quite well. While I realize that I can use make the 
target element be anything I want like the H1 tag in this example, the 
anchor is created by a web text editor called CKEditor. I'll have to see 
what I can do to add the class when the anchor is created.

Thanks again.

On Wednesday, October 16, 2013 7:08:06 AM UTC-7, Paolo Caruccio wrote:
>
> 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 */
>   margin-top: -40px; /* the negative value as above */
>   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 neccessarily 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 issue but this works and is fast.
>
> Caveats: this solution doesn't work in IE7 and below
>
>     
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to