Showing 1 – 1 of 1 replies
Xma

Help: sow_ajax_navigation

Xma PURCHASED
1 year ago
Dorian, Hi! I need you help

I don't understand one thing. I am creating a website with Ajax navigation.

Core.js:
enable: true,
target_container: '#middle',
parser_extract_enable: true,

The links in the document are as follows:
<a href="#" data-href="..." data-ajax-method="POST" data-ajax-update-url="false" data-ajax-callback-function="func" class="js-ajax">

I connect scripts in the basement:
<script core.js>
<script vendor_bundle.js>
<script custom_bundle.js>

In custom.js I have a function
jQuery('body').on('click', '.test', function (c) {

console.log('click')

jQuery(this).toggleClass('expand').next Until('.sub-test').slideToggle(0)

})

Problem:
On the first page, the click event on .test works as it should.
On the second page, when clicked, it is triggered 2 times, i.e. it opens and closes the element at once.
On the third page, when clicked, it is triggered 3 times, i.e. open - close - open.
And then an event is added on each page +1 time.

If I write to footer, then everything works as it should:
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
.. click event ...
});
...

What am I doing wrong here if reinit func in custom_bundle occurs during transitions.js, but events from this file start to manifest themselves not as expected?

Thank you =)
Xma
Xma PURCHASED
1 year ago
And maybe in the file sow.ajax_navigation.js make an edit?

String 543:
$.SOW.helper.loadingSpinner('show', _target);

She launches the spinner in _target

String 574, 818, 1055, 1087:
$.SOW.helper.loadingSpinner('hide');

They do not remove the spinner in _target, but everything from the page, including custom ones in other js.