How to make a non-refreshing nav menu?

Hi guys!
I have another interesting question.

How to make non-refreshing parts of a page?

for example: Featured | Blocs Store
if you press something from the navmenu:


only specific area of the pages refreshes, but the rest stays static.

In my case when the nav link is being selected the whole page refreshes.
But I need to make header and footer stay unrefreshed.

I hope that explanation was understandable :sweat:

I guess I will need to use AJAX but I’m not certain on how to implement it.

Ive found this code and I guess it should work:

  $.ajax({
       type: "GET",
       url: 'getnewData.php',
       success:function(response){
           $('#myElement').html(response);
       },
  });

I have done something similar with the navigation tabs.

Put a tab on your page and add anything you want and then hide the tab links at the top and link your menu to each tab. You must add all the information from the tabs to your menu.

The only problem is your url wont change.

For sure there is better way of doing this and some else will share it here :slightly_smiling_face:

1 Like

Hi! That is an interesting idea! I’ll give it a go if I don’t succeed with a script. Thank you! :blush:

Post it here if you success please I want to do the same :smiley:

of course!

1 Like
2 Likes

Success! Thanks to Pealco link I’ve figured everything out! Cheers, Pealco! :blush:

1 Like

Here is the solution:

First of all you will need to create a page with a header and a footer and an empty container with fullscreen padding in-between. No global areas needed. It will be your main page. And basically the only page that will be fully loaded.

Then you will need to create pages with the content that should be loaded. No header or footer needed, it is already present in your first page.

Then you will need to attach these two files to your main page in the settings.


page attachments.zip (5.1 KB)

Then you must add this code to the header area of your page (select all, copy and paste):

code.zip (1.0 KB)

Then, most importantly you will need to set right IDs.


page-wrap is your bloc in-between a header and a footer


main-content is the container within the bloc
guts is the row within that container

FINALLY you must do the same thing to all of your content pages. Same IDs, same everything.

or you can simply use my template
dynamic page template.bloc.zip (455.1 KB)

The only downside is that nav active class doesn’t work as it should because the only page that is active is your main page. If anyone has the solution it will be gladly appreciated :relaxed:

2 Likes

Awesome! Great job and thank you so much for sharing :slight_smile:

2 Likes

The only downside is that nav active class doesn’t work as it should because the only page that is active is your main page. If anyone has the solution it will be gladly appreciated

okay, by running through the code I’ve figured out that the answer is somewhere here:

  $("nav a").removeClass("current");

  $("nav a[href$='" + href + "']").addClass("current");

But naming the active class current doesn’t do its job

1 Like

okay by digging through code and trying different things I figured out that my instruction is useless.
:man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming:

You don’t actually need to copy and paste any code. You just need to attach dynamicpage.js to your project and add correct IDs.

1 Like

okay. Here is an updated tutorial.

  1. You add the same IDs as in previous tutorial.
  2. Attach this two files to your project in Project Attachments.
    dynamicpage.zip (5.0 KB)
  3. Profit.

This method doesn’t make your links look like this: example.ccc/page1#page2.html.
That means .active class should work now (it relies on a link text that’s why it didn’t work before. If address is the same as your navlink then .active class transfers to your active navlink). But it doesn’t.

1 Like

Thank you @EffexorXR for your sharing, glad the link was useful…

1 Like

.active class won't work on a dynamic page - #9 by EffexorXR here is a final fixed project! :partying_face: :partying_face: :partying_face:

1 Like

It’s fantastic, and the effect of non refreshing is very smooth, thank you…

1 Like

Thank you so much for doing this!!! :blush:

1 Like