var mycarousel_itemList = [ {url: '/about_us/', img: '/images/toj-hl.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaAndChild.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaSOTU.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaAtDeskSeated.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaAtVetCemetary.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaAtWindow.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaBushClinton.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaCollonadeWalk.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaFistJabWithTroops.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaInFrontOfWH.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaInnerCircle.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaNobelSpeech.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaSignsLegislation1.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaSignsLegislation2.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaSituationRm.jpg', title: 'Welcome to the Obama Journal'}, {url: '/about_us/', img: '/images/ObamaWithNobelPrize.jpg', title: 'Welcome to the Obama Journal'} ]; function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt) { // The index() method calculates the index from a // given index who is out of the actual item range. var idx = carousel.index(i, mycarousel_itemList.length); carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1])); } function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt) { carousel.remove(i); } // Item html creation helper. function mycarousel_getItemHTML(item) { return '' + item.title + ''; } jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ auto: 5, scroll: 1, wrap: 'circular', itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback}, itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback} }); });