merged @pjackson28's changes to v4.0 branch in PR #3782 into this branch, but merged them into carousel.js instead of tabs.js