Ajax.Navigation.js

Methods

You call every method like this:

$(".ajax_follow").ajaxNavigation({
    areas : "#ajax_content"
});

$(".ajax_follow").data("ajaxNavigation").someMethod();

Available methods

returnEffects()
Returns Array

Returns an array containing all available effects.

Code example

console.log($(".ajax_follow").data("ajaxNavigation").returnEffects());
/ returns e.g: ["slide-left", "slide-right", "slide-top", "slide-bottom", "default"]
returnLoadedContent()
Returns String

Returns the last content that was loaded via ajax (not parsed). Content is being saved until another page is loaded.

Code example

console.log($(".ajax_follow").data("ajaxNavigation").returnLoadedContent());

Example usage

$(".ajax_follow").ajaxNavigation({
    areas : "#ajax_content",
    afterTransitionEnd: function(){
        if($(".someElement").length <= 0) / check if element already exists
        {
            var html = $(".ajax_follow").data('ajaxNavigation').returnLoadedContent(); / get latest content
            $("body").prepend($(html).filter(".someElement")); / add element to the body
        }
    }
});
returnLastLoadedURL()
Returns String

Returns the last loaded URL. Variable is updated every time an ajax call is completed.

Code example

console.log($(".ajax_follow").data("ajaxNavigation").returnLastLoadedURL());
/ returns e.g: /ajax/doc/methods
setSelectorActive()
Returns Nothing

Sets a selector active.

Code example

$(".ajax_follow").data("ajaxNavigation").setSelectorActive(".inactiveElement")
setSelectorInactive()
Returns Nothing

Sets a selector inactive. Clicking on this selector results in the page being loaded normally.

Code example

$(".ajax_follow").data("ajaxNavigation").setSelectorInactive(".activeElement")
removeAjaxNavigation()
Returns Nothing

Removes AjaxNavigation.

Code example

$(".ajax_follow").data("ajaxNavigation").removeAjaxNavigation();