NAVX

Tutorial and guides

Callbacks

Set the callback options at the navigation initialization

You can execute a javascript code after booting the navigation after switching from portrait mode to landscape mode and in other situations. See below how to use.

onInit

Executes your custom code when the navigation is initialized:

Copy
var navigation = new Navigation(document.getElementById("navigation"),{
    onInit: function(){
        alert("Initialized");
    }
});
onLandscape

Executes your custom code when the navigation goes to landscape mode:

Copy
var navigation = new Navigation(document.getElementById("navigation"),{
    onLandscape: function(){
        alert("Landscape mode");
    }
});
onShowOffCanvas

Executes your custom code when the offcanvas panel is visible:

Copy
var navigation = new Navigation(document.getElementById("navigation"),{
    onShowOffCanvas: function(){
        navigation.classList.add("myClass");
    }
});
onHideOffCanvas

Executes your custom code when the offcanvas panel is hidden:

Copy
var navigation = new Navigation(document.getElementById("navigation"),{
    onShowOffCanvas: function(){
        navigation.classList.remove("myClass");
    }
});

See the list of tutorials for other ways to modify the navigation bar and add features.