var UNISA = UNISA || {}; UNISA.slideshow = (function (doc, $, undefined) { var cycleHomepage = function () { var paused = false; $('#hero-banner').each(function () { var $this = $(this), opts = { pager: '#banner-nav', fx: 'fade', speed: 1500, timeout: 5000, //pauseOnPagerHover: true, pause: 1 }; //if we have a media centre, than we need to add some buttons. if ($this.is('.media_centre')) { opts.prev = $this.find('.prev'); opts.next = $this.find('.next'); opts.fx = 'scrollHorz'; // For fade effect change opts.speed = 800, opts.timeout = 6000, opts.pause = 1 } $this.find('#slider').cycle(opts); //ie focus fix, opacity on hover/focus $('#banner-nav a, #pausePlay').on("mouseenter focus", (function () { $(this).toggleClass('ie7focus', true); $('#banner-nav a, #pausePlay').toggleClass('hiviz', true); })).on("blur mouseleave", (function () { $(this).toggleClass('ie7focus', false); $('#banner-nav a, #pausePlay').toggleClass('hiviz', false); })); // Pause/play buttons $('#pausePlay').toggle(function () { $('#slider').cycle('pause'); $('#pausePlay span').html('Play slideshow'); $(this).toggleClass('paused', true).attr('title', 'Slideshow paused. Click to play'); paused = true; }, function () { $('#slider').cycle('resume', true); $('#pausePlay span').html('Pause slideshow'); paused = false; $(this).toggleClass('paused', false).attr('title', 'Click to pause slideshow'); } ) }); // If user tabs to slide, pause slideshow $('#slider li a').focus(function () { $('#pausePlay span').html('Play slideshow'); $('#slider').cycle('pause'); }).blur(function () { if (!paused) { $('#slider').cycle('resume', true); $('#pausePlay span').html('Pause slideshow'); } }); }, cycleInline = function () { var paused = false; $('.inline-banner > ul').cycle({ pager: '#banner-nav .paging', fx: 'scrollHorz', speed: 800, timeout: 6000, pause: 1, next: '#banner-nav .next-slide', prev: '#banner-nav .prev-slide' }); // Pause/play buttons $('.inline-banner #pausePlay').toggle(function () { $('.inline-banner #pausePlay span').html('Play slideshow'); $(this).toggleClass('paused', true).attr('title', 'Slideshow paused. Click to play'); $('.inline-banner > ul').cycle('pause'); paused = true; }, function () { $('.inline-banner #pausePlay span').html('Pause slideshow'); $('.inline-banner > ul').cycle('resume', true); $(this).toggleClass('paused', false).attr('title', 'Click to pause slideshow'); paused = false; } ); // Reset opacity on focus, ie focus fix $('.inline-banner #banner-nav a').focus(function () { $(this).toggleClass("ie7focus", true); $('.inline-banner #banner-nav a').toggleClass("hiviz", true); }).blur(function () { $(this).toggleClass("ie7focus", false); $('.inline-banner #banner-nav a').toggleClass("hiviz", false); }); // If user tabs to slide, pause slideshow $('.inline-banner > ul a').focus(function () { $('.inline-banner > ul').cycle('pause'); $('.inline-banner #pausePlay span').html('Play slideshow'); }).blur(function () { if (!paused) { $('.inline-banner > ul').cycle('resume', true); $('.inline-banner #pausePlay span').html('Pause slideshow'); } }); } return { init: function () { cycleHomepage(); cycleInline(); } }; })(document, jQuery); var jQuery_1_7_1 = jQuery.noConflict(); jQuery_1_7_1(document).ready(function () { UNISA.slideshow.init(); });
var UNISA = UNISA || {}; 等价于 if(UNISA){ var UNISA = UNISA; }else{ var UNISA = {}; }