I'm using a slider and it won't initiate unless I reload while on the page. A alert will run but the script won't start until I reload the page.
I've tried embeding the javascript on the page on ready().
I've tried embed the javascript on page ready.
Barba.Dispatcher.on('newPageReady', function() { ..slider do things..
This also didn't work. Only on load will the slider
var work = Barba.BaseView.extend({
namespace: 'work',
onEnter: function() {
},
onEnterCompleted: function() {
$('.portfolio-slider').slick({ ....
Any help would be much apreciated.
Try using Barba.Dispatcher.on:
Barba.Dispatcher.on('newPageReady', function(currentStatus, oldStatus, container, rawHTML) {
$('.portfolio-slider').slick({
...
});
});
@kjbrum Thank you very much. You saved my life!
Where di you find that? Do they have mentioned it on barbajs docs? I couldn't find.
@dmcshehan It's listed on the events page. http://barbajs.org/events.html
I have another question. When I use Barba js on my website, php WordPress functions like "body_class()" isn't working. I think it's because ajax. What do you suggest?
This is the website I'm building
http://labnero.mentall.be/
@dmcshehan add body_class on your barba-container, instead of the body.
Most helpful comment
Try using
Barba.Dispatcher.on: