var widgetSlideShow = { init: function () { var options = widgetSlideShow.options; $(".slide-tabs").tabs(".slide-images > div", $.extend({}, { onBeforeClick: function (event, i) { var slideshowDiv = $(event.target).closest('.slideshow'); slideshowDiv.find('.youtube iframe').attr('src', ''); if (slideshowDiv.find('.video a').length > 0) { slideshowDiv.find('.video a').flowplayer().each(function () { this.stop(); }); } }, onClick: function (event, i) { var selectedDiv = $(event.target).closest('.slideshow').find('.slide-images > div').eq(i); if (!!selectedDiv) { var youtubeObjs = selectedDiv.find('.youtube'); if (youtubeObjs.length > 0) { youtubeObjs.each(function () { widgetYoutube.initYoutube(youtubeObjs); }); } var videoObjs = selectedDiv.find('.video a'); if (videoObjs.find('object').length > 0) { videoObjs.each(function (i) { videoObjs.eq(i).flowplayer(0).play(); }); } } } }, options) ).slideshow(); $(".slide-tabs").each(function () { var autoscroll = $(this).attr("autoscroll"); if (autoscroll == "true") { var api = $(this).data("slideshow"); api.play(); } }); }, // init() end options: { effect: 'fade', fadeOutSpeed: 'slow', rotate: true, interval : 3000 } } $(this).on('load.slideshow', widgetSlideShow.init);