• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

slider doesn't work in ajax loaded content

Avast

👽 Chevereto Freak
I'm using the script of chevereto-docs to load my content (https://chevereto.com/community/threads/script-like-chevereto-docs.2869/)

Now i want to load content, which contains an image-slider (js http://codecanyon.net/item/royalslider-touchenabled-jquery-image-gallery/461126).
But i don't know how to connect the content-load-script with the call of the image-slider-function.
(The Slider works , when the content loads via php).
I tried (just for testing) to bind the call of the slider-function on a menu-item via jQuerys .click function (didn't work, only after clicking twice).

I think the best way , to call the function is, to implement the call into this function:

Code:
function loadDocs() {
    $(main_col).load('/content/docs_loader.php?page='+document.location.hash.replace('#!',''), function(response, status, xhr) {
        $('.loading').fadeOut(1000, function() { $(this).remove(); });
        var h2title = $(main_col+' h2').html();
        if (status == "error") {
            document.title = doctitle;
            $(main_col).html('404');
        } else {
            document.title = doctitle+' | '+h2title;
        }     
        _gaq.push(['_trackPageview', "/docs/?_escaped_fragment_="+normal_hash.replace('#','')]);
    }).hide().fadeIn('slow');
}

Does someone know how to deal with this problem?
 
When you load content, or you change the contents of a page using javascript, all the event listeners that doesnt use the .on() method won't work because the content has changed after the slider definition. I got the same problem with the script that formats the code (it puts colors and things like that). The solution is call this code in execution and in every instance that you use to add new content.
 
Back
Top