The state object is returned as the first argument of all callback functions, and is also available via the ‘getState’ API method. It contains useful information about the current filter and sort state.
The State object contains the following properties:
state.activeFilter
– the active filter string, object or functionstate.activeSort
– the active sort stringstate.fail
– a boolean indicating if no targets matching the filter were foundstate.$targets
– a jQuery object collection of target elementsstate.$show
– a jQuery object collection of currently shown target elementsstate.$hide
– a jQuery object collection of currently hidden target elementsstate.totalTargets
– the total number of target elements in the containerstate.totalShow
– the total number of target elements currently shownstate.totalHide
– the total number of target elements currently hidden
The State object can be retrieved as follows:
$('#Container').mixItUp({
callbacks: {
onMixEnd: function(state){
console.log(state)
}
}
});
The state object is available as the first parameter of all callback functions
$('#Container').on('mixEnd', function(e, state){
console.log(state);
});
Any event handlers bound to MixItUp events with jQuery's
.on()
or.bind()
methods, receive the state object as the second parameter of the callback function.
var state = $('#Container').mixItUp('getState');
console.log(state);
The state object is also available via the "getState" API method at any time.
© 2014 KunkaLabs Limited