These are chat archives for idiot/unslider

2nd
May 2017
diritor
@diritor
May 02 2017 09:25
hello!I would like to ask if there is opportunity yo play with the view-order of the slides-pictures depending if u click on them !
Thanks
Rjrr
@ricardojriosr_twitter
May 02 2017 14:03
Hi I did something like that, but to reorder the items
randomize them
$.fn.randomize = function(selector){
var $elems = selector ? $(this).find(selector) : $(this).children(),
$parents = $elems.parent();
    $parents.each(function(){
        $(this).children(selector).sort(function(){
            return Math.round(Math.random()) - 0.5;
        }).detach().appendTo(this);
    });

    return this;
};
$(function () {
    $(".unslider").each(function(i, obj) {
        var first_round = $(obj).children().children().children().last();
        first_round.on('classChanged', function() {
            if (!$(this).hasClass('unslider-active')) {
                var unslider_ul = $(obj).children().children().randomize();
            }
        });
    });