Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jquery function is not working after loading with ajax #436

Open
recruitname opened this issue Feb 27, 2017 · 1 comment
Open

jquery function is not working after loading with ajax #436

recruitname opened this issue Feb 27, 2017 · 1 comment

Comments

@recruitname
Copy link

On my web page, everything is okay.

My js is working very well but clicking on any page, page is loading with ajax but some function is not working for example my bootstrap carousel or my parallax.js plugin..

How do I do event management ?

some js example on my page

`if (!$(".scene").length) return false;
var q = document.getElementsByClassName("scene")[0];
var r = new Parallax(q, {
calibrateX: false,
calibrateY: true,
invertX: false,
invertY: true,
limitX: false,
frictionX: .2,
frictionY: 4,
originX: 0,
originY: 1
});

$('.img-area').cycle({
fx: 'fadeout',
speed: 950,
timeout: 100
}).cycle("pause");

$(".otel-history-list").on("click",function(){

var historyName = $(this).find(".history-current-name").text();
var historyDateIn = $(this).find(".history-current-datein").text();
var historyDateOut = $(this).find(".history-current-dateout").text();
var historyKisi = $(this).find(".history-current-kisi").text();

$(".input-form-ara input").val(historyName);
$(".otel-giris-cikis #checkin").val(historyDateIn);
$(".otel-giris-cikis #checkout").val(historyDateOut);
$(".kisi-sayi-otel-sec .kisi-count").text(historyKisi);

});`

and my spf code

`$(function () {
spf.init();
NProgress.configure({ showSpinner: false });

$(document).on('spfrequest', function (event) {
    NProgress.set(0.4);
});

$(document).on('spfprocess', function (event) {
    NProgress.set(0.6);
    NProgress.set(0.8);
});

$(document).on('spfdone', function (event) {
    NProgress.set(1.0);
    NProgress.done();

});

$(document).on('spfhistory', function (event) {
    NProgress.set(0.7);
    NProgress.set(0.9);
    NProgress.set(1.0);
    NProgress.done();

});

});`

@VarinderS
Copy link

It could be because .scene div and .img-area divs are getting replaced by the new ajax content?

If that is the case, you may want to re-initalize parallax cycle plugin inside of spfdone event...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants