This article explains how to build a website where menu options target different places within the same page, with smooth transitioning between views.
First, let’s see how to create options that slide to another place in the same page.
To achieve this, follow the steps below:
1) Create a menu with all options, setting each option to point to an external link. Each link will be the name of an anchor.
For example, an option will point to the #services external link.
The image below shows how to define options:
1) From the backend, go to the options Design -> HTML.
Set the anchors in the corresponding places; that is to say, the places where you want to go upon clicking on each menu option.
The HTML code to set an anchor is as follows:
If you only want to set one anchor in a certain place, you can add a Free HTML GXportlet using the code shown above. Repeat this process for every anchor you want to create.
To add an anchor in a Content GXportlet, you can add this code at the beginning of the content abstract or body.
Once we have completed the previous two steps we will have a menu with options. Clicking on an option will take us to a certain place within the same page.
The websites G. CASCO
show in action what we have explained.
How to configure a sliding transition effect?
To do so, follow the steps below:
Click on the New button to open an editor.
Click on this button
In the edit area, copy the following code:
by the URL of your site in production.
Click on the Save button.
If the website is in more than one language, you will have to add this code to each language.
Open the page design view, and add the Free HTML GXportlet at the beginning of the page.
Click on this button:
and associate the HTML code defined in the previous step.