Update carousel.js

included dynamic calculation of number of items to show in the carousel from width