dio-v
4/2/2014 - 11:11 AM

ruwe snippet uitwerken!

ruwe snippet uitwerken!

    //detailpage thumbs
    if ($('.dThumbs').length) {
        var vD = $('.dThumbs');
        var vH = vD.outerHeight();
        var vL = -1;
        var vRows = (vD.data('rows'));
        var maxH = 0;
        vD.find('.detailFoto').each(function (index) {
            var vT = $(this);
            if (index == 0) {
                vL = vT.offset().left;
                vT.addClass('itemRow')
            } else if (vT.offset().left == vL) {
                vT.addClass('itemRow')
            }
        });
        var rows = vD.find('.itemRow').length;
        if(rows > vRows){
            vD.after('<a href="#" class="moreThumbs">toon alle thumbnails</a>');
            for (var i = 0; i < vRows; i++) {
                maxH += vD.find('.detailFoto:nth-child(' + (i + 1) + ')').outerHeight();
            }
            vD.css({ 'height': maxH + 'px', 'overflow': 'hidden' });
            vD.next('.moreThumbs').bind('click', function () {
                vD.animate({ 'height': vH + 'px' });
                $(this).remove();
                return false;
            });
        }
    }