Welcome! Log In Create A New Profile

Advanced

WB22 - Static HTML5 Page - Floating "Top of Page"

Posted by DerekM 
WB22 - Static HTML5 Page - Floating "Top of Page"
September 25, 2018 06:42AM
Hi

I am using a WebDev 22 static project for documentation (working out really well for me).

I am using Page Menu at the top of each page - a page being very long - an entire chapter/subject - and the only thing I need to make me happy is one of those floating "Top" or "Top of Page" button thingies (to go back to the menu).

At the moment I am guessing this needs only a few lines of JavaScript or something - but has anyone done this with WebDev and can give a pointer as to the best way to achieve this?

Many thanks in advance for any advice or suggestions.

Regards,
Derek
Re: WB22 - Static HTML5 Page - Floating "Top of Page"
September 25, 2018 10:43AM
Hi Derek,

You don't even need any javascript, just css will do:
Add this css to the header of your page, for instance by code;
MyPage..HTMLHeader+=CR+[
<style>
#navbar {position:fixed;top:0;left:0;z-index: 1;width:100%;height: 94px;}
</style>
]
And in the advanced tab of the cell you need floating on top you put a div around it by adding:
HTML code before: <div id="navbar">
HTML code after: </div>

Kind regards,
Piet
Re: WB22 - Static HTML5 Page - Floating "Top of Page"
September 25, 2018 01:09PM
Hi Derek

personally, in a case like that, I prefer to have the menu always visible at the top, and that is done by making the menu in a cell, and in the cell properties, saying that it is anchored at the top.

Now, of course, you can also have your button in a cell like that and in the button set it as a link to an "anchor" (html sense). You just need in that case to have a control at the top of the page that is declared as an anchor (control properties, once again)

No need of any code at all...

Best regards

Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on [www.fabriceharari.com]
Re: WB22 - Static HTML5 Page - Floating "Top of Page"
September 25, 2018 02:42PM
Thank you Piet. Works Great! smiling smiley

Also Fabrice, I think your suggestion will work even better.smiling smiley
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: