Hello Air, I have a problem using AJAX. On my site, when ajax is enabled, when I go, for example, from the main page to the blog, and then to the page of post, two plugins do not work: Q2W3 Fixed Widget (i fix a few widgets in sidebar) and Yandex Share buttons. They starts to work only after reloading the post page. So the music starts from the begining...
Can you advise something to solve this problem, so that music work correctly with these features.
Like explained here http://apollo13.eu/docs/photon/#!/ajax_settings other plugins may come in conflict with Photon theme AJAX, and they might not work well. AJAX is rather intended for sites that will focus on using in theme features.
You would have to dig into these plugins and find what function they run to fire their JavaScript.
I fond out that i can add javascript in form "Custom javascript". Can you suggest how to put here 2 or more javascipts? 1 load perfectly, but 2 or more... don't work.
You can put there as many code as you want, just be sure that it is valid JavaScript code. So if you copy code from various Javascript files, then just separate theme with few "enters" ;-)
This is what you put in custom JavaScript code? Then you are lucky that anything works at all. This field is for JavaScript code, not for HTML code that embeds JavaScript. This is more for callback that should be called there after AJAX page reload.
If you don't know what should be put there, you can try to put whole source code of JavaScript file, but I don't promise it will fire these scripts.
Do you have both codes added now? I am on your site and I don't see any error, which probably happens when you have both. Reply here when you will have two again.
No. I don't add javascript code for yandex share in "custom javascript" now. As it don't works with javascipts for Q2W3 Fixed Widget and Shortcodes-ultimate in "custom javascript". I have tried many times. I don't know why, but if i put javascript code only for yandex share buttons in "custom javascript" - it works. So , maybe, i could put code for javascript for share buttons to some file, not in "custom javascript", so that it started to work togather...? with ajax...
I suspect two things, but can't tell without you adding this code back on your site. 1. There is some JavaScript error when you add this files. Check console(F12) what it says when you add both files. 2. There is limit how much code can be put in custom javascript. I don't know anything about such limit but it is possibility.
PavelT said: So , maybe, i could put code for javascript for share buttons to some file, not in "custom javascript", so that it started to work togather...? with ajax...
Now that I think about it, this filed "custom javascript" is not connected with ajax just on its own. Only if you will create callback to theme ajax function, then this makes sense. In this case you can as well add all your code at end of js/script.js file. It should give same result, if I am right.
Comments
Thanks and sorry
With kind regards.
I have a problem using AJAX.
On my site, when ajax is enabled, when I go, for example, from the main page to the blog, and then to the page of post, two plugins do not work: Q2W3 Fixed Widget (i fix a few widgets in sidebar) and Yandex Share buttons. They starts to work only after reloading the post page. So the music starts from the begining...
Can you advise something to solve this problem, so that music work correctly with these features.
Thank you,
Pavel.
Like explained here http://apollo13.eu/docs/photon/#!/ajax_settings other plugins may come in conflict with Photon theme AJAX, and they might not work well. AJAX is rather intended for sites that will focus on using in theme features.
You would have to dig into these plugins and find what function they run to fire their JavaScript.
With kind regards.
I fond out that i can add javascript in form "Custom javascript".
Can you suggest how to put here 2 or more javascipts?
1 load perfectly, but 2 or more... don't work.
Thank you,
Pavel.
So if you copy code from various Javascript files, then just separate theme with few "enters" ;-)
With kind regards.
Can you advise another method to load javascript with ajax, as some javascripts simply don't work in field "custom javascript"?
For example: javascript for yandex share buttons works well when i use it alone.
If i use it with other javasipts in field "custom javascript" then noone work.
If i use other javascripts without "yandex share buttons" then they work.
<script src="//yastatic.net/es5-shims/0.0.2/es5-shims.min.js"></script> <script src="//yastatic.net/share2/share.js"></script>
With kind regards.
This is more for callback that should be called there after AJAX page reload.
If you don't know what should be put there, you can try to put whole source code of JavaScript file, but I don't promise it will fire these scripts.
With kind regards.
Thank you for reply.
As i said all full codes of javascripts don't work together. Separately they work.
With kind regards.
So , maybe, i could put code for javascript for share buttons to some file, not in "custom javascript", so that it started to work togather...? with ajax...
1. There is some JavaScript error when you add this files. Check console(F12) what it says when you add both files.
2. There is limit how much code can be put in custom javascript. I don't know anything about such limit but it is possibility. Now that I think about it, this filed "custom javascript" is not connected with ajax just on its own. Only if you will create callback to theme ajax function, then this makes sense. In this case you can as well add all your code at end of js/script.js file. It should give same result, if I am right.
With kind regards.