• 命名空间


    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 = {};
    }
  • 相关阅读:
    委托和事件
    Entity Framework应用:导航属性
    Entity Framework应用:根据实体的EntityState状态实现增删改查
    Entity Framework应用:使用EF的DataBase First模式实现数据库的增删改查
    Entity Framework应用:EntityFramework DataBase First模式
    dapper支持操作函数和事物
    单元测试
    IOC容器:Unity
    MVC教程九:异常过滤器
    MVC教程八:缓存过滤器
  • 原文地址:https://www.cnblogs.com/oceanden/p/3977872.html
Copyright © 2020-2023  润新知