arvgta / ajaxify

Ajaxify - An Ajax Plugin
https://4nf.org/
275 stars 123 forks source link

Whole page is being replaced instead of target container #193

Closed propertunist closed 4 years ago

propertunist commented 4 years ago

Hi, I have added Ajaxify to a relatively simple website that was made using the webflow online site design system but is now hosted on a third party server. I have set Ajaxify to update based on the links in the main navigation being clicked and to only replace the main content container in the middle of the site. As far as I can tell, the system is working because I don't think the whole page is being refreshed when I click a link - however, for some reason it looks like the entire page content is being loaded by ajax instead of just loading the main content area. The main reason for ajaxifying the site is because it needs to have a persistent audio player that is currently situated in the navigation area (hidden) - so the current outcome is not sufficient. I have configured ajaxify to run using the recommended format of:

$('#contentcontainer').ajaxify();

I've also played with various configuration options but none of them have solved the problem. Do you have any thoughts on why this might be happening? Thanks

arvgta commented 4 years ago

Hi,

Thanks for pointing this one out!!

Yes, it is due to this latest change for sure. I would like to apologise, but we didn't think about your type of use case thoroughly enough.

Right now, what is happening in the last version is that we have tried out swapping the whole body.

I reckon, this mechanism is too harsh for your use case, let's call it a "hard body swap".

I'm wondering, whether it would help you, if we turned it into a "soft body swap". What I mean with that is, that we could just do something like swap the HTML contents within the body and not re-assemble absolutely everything concerning the body tag...

Do you think that that approach would be viable?

You can definitely use versions, that are a bit older for the time being in any case...

Thanks and regards

arvgta commented 4 years ago

If you like, you could test this file against your site and see, whether the issue persists... (I just tweaked something concerning body tag handling)

propertunist commented 4 years ago

Hi, thanks for assisting here. I tired the new version of the file but that does not fix the issue.

I don't really understand what you are talking about here because I thought that the whole point of your plugin was to allow only specific elements in a page to be replaced when a page is loaded. If you are replacing the entire body of a page in all cases then to me that seems to remove any benefit of the plugin. I am very confused as to what you are trying to achieve by replacing the entire body.

Is there a reason to remove the core functionality of switching only targeted elements? As a designer and developer, I can't really see any benefit to doing so and only downsides.

Can you provide me with an older version of the script that I can test to make sure that this is the cause of my issues?

Thanks

arvgta commented 4 years ago

I would like to apologise once more - of course the idea of a whole body swap was strategical nonsense.

I will perform a rollback to the previous version for the time being asap...

(That one should work for you, if not the one before - please do tell us, which older version works for you, so that we know, which one to rollback to...)

Thanks!

edito commented 4 years ago

In this case everything can be done in a way that default swap element is body, but if there is any element provided by user to do just swapping of it. This will merge old and new powers.

arvgta commented 4 years ago

Hi Edin,

Thanks for tuning in!

I think we should revert to the old system of letting the user specify as many IDs as he likes. Then, additionally, we could support the whole body as a special case - maybe with special handling...

arvgta commented 4 years ago

(unless an overwhelming number of users need just one container - which is probably not the case - have a look at the current demos page)

arvgta commented 4 years ago

@propertunist : If you can state, which old version works for you, I could perform a rollback today...

propertunist commented 4 years ago

@arvgta thanks for your tips. I tried 7.5.6 and can confirm that it is working as expected here. :)

arvgta commented 4 years ago

Hi there!

That's comparatively good news - I'm glad it wasn't an even older version!

Much appreciated!

Will perform the rollback asap... :)

propertunist commented 4 years ago

hehe, ok, great thanks