$(document).ready(function() {
    $(window).load(function() {$('.mask').css('width',getMaskWidth());});
    $(window).resize(function() {$('.mask').css('width',getMaskWidth());});
        
    function getMaskWidth(){
        var windowidth=$(window).width();
        var elwidth=$('.mask li').outerWidth(true);
        var elcount=Math.floor(windowidth/elwidth);
        var maskWidth=elcount*elwidth;
        return maskWidth;
    }
    
    function getCountEl(){
       var windowidth=$(window).width();
       var elwidth=$('#my-carousel li').outerWidth(true);
       var elcount=(Math.floor(windowidth/elwidth));
       return elcount;
    }
    
    $('#my-carousel').carousel(
    {
        itemsPerTransition: getCountEl(), //number of items moved with each transition
        noOfRows: 3, // number of rows (see demo)
        nextPrevLinks: true, // whether next and prev links will be included
        pagination: false, // whether pagination links will be included
        speed: 'medium', // animation speed
        easing: 'linear', // supports the jQuery easing plugin
        nextprevposition:'right'
    });
});
