$(window).on('load', function () {
$(window).trigger('resize');
}); $(function () {
  var $window = $(window),
  isLoaded = false;   function resizeBg() {
    var winWidth = $window.width(),
      winHeight = $window.height(),
      viewportAspectRatio = winWidth / winHeight;     $('.full-bg').each(function (index, item) {
      var $bg = $(item),
      bgWidth = $bg.width(),
      bgHeight = $bg.height(),
      aspectRatio = bgWidth / bgHeight;         if (viewportAspectRatio < aspectRatio ) {
          $bg.removeClass('full-width')
            .addClass('full-height')
            .css({
               top: 0,
               left: -(winHeight * aspectRatio - winWidth) / 2
             });
        } else {
          $bg.removeClass('full-height')
            .addClass('full-width')
            .css({
              top: -(winWidth / aspectRatio - winHeight) / 2,
              left: 0
            });
        }
    });
  }
  $window.on('resize', resizeBg);   $('.full-bg').on('load', function () {
    $(window).trigger('resize');
  });
}); enquire.register('screen and (max-width: 760px)', {
  match: function () {
    $('.responsive-img').each(function () {
      var $img = $(this),
        src = $img.data('mobile-src');
      if (src) {
        $img.attr('src', src).show();
      } else {
        $img.hide();
      }
    });
  },
  unmatch: function () {
    $('.responsive-img').each(function () {
      var $img = $(this),
        src = $img.data('src');
      if (src) {
        $img.attr('src', src).show();
      } else {
        $img.hide();
      }
    });
  }
}); enquire.register('screen and (min-width: 761px)', {
  match: function () {
    $('.responsive-img').each(function () {
      var $img = $(this),
        src = $img.data('src');
      if (src) {
        $img.attr('src', src).show();
      } else {
        $img.hide();
      }
    });
  },
  unmatch: function () {
    $('.responsive-img').each(function () {
      var $img = $(this),
        src = $img.data('mobile-src');
      if (src) {
        $img.attr('src', src).show();
      } else {
        $img.hide();
      }
    });
  }
});

full-background.js的更多相关文章

  1. chrome插件background.js 和 popup.js 交互

    要实现background.js 和 popup.js 之间的交互,首先需要先配置好 manifest.json文件,如: "background":{ //"page& ...

  2. metamask源码学习-background.js

    这个就是浏览器后台所进行操作的地方了,它就是页面也区块链进行交互的中间部分. metamask-background描述了为web扩展单例的文件app/scripts/background.js.该上 ...

  3. Node.js异步处理CPU密集型任务

    Node.js异步处理CPU密集型任务 Node.js擅长数据密集型实时(data-intensive real-time)交互的应用场景.然而数据密集型实时应用程序并非仅仅有I/O密集型任务,当碰到 ...

  4. 转:Node.js异步处理CPU密集型任务的新思路

    原文来自于:http://www.infoq.com/cn/articles/new-idea-of-nodejs-asynchronous-processing-tasks?utm_source=i ...

  5. vue的测试(Vue.js devtool)

    1. 安装chrome插件:Vue.js devtools(https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejigli ...

  6. vue-devtools(vue 2.0)手动安装与使用 ? 如何处理Vue.js is detected on this page ?

    vue-devtools手动安装与使用   一.在github上下载压缩包,github下载地址:https://github.com/vuejs/vue-devtools 二.解压到本地的某盘 三. ...

  7. 【转】利用 three.js 开发微信小游戏的尝试

    前言 这是一次利用 three.js 开发微信小游戏的尝试,并不能算作是教程,只能算是一篇笔记吧. 微信 WeChat 6.6.1 开始引入了微信小游戏,初期上线了一批质量相当不错的小游戏.我在查阅各 ...

  8. Chrome插件开发,美化网页上的文件列表。chrome-extension,background

    上一篇文章 通过“content-scripts”的方式向页面注入js和css来美化页面,但是有一个弊端:一旦配置好需要注入的页面,之后如果这个页面地址以后发生变化,或者要新加一些URL进来,那么得修 ...

  9. metamask源码学习-ui/index.js

    The UI-即上图左下角metamask-ui部分,即其图形化界面 The MetaMask UI is essentially just a website that can be configu ...

  10. js:浏览器插件

    1.chrome background.js //chrome.webRequest.onBeforeRequest.addListener(function(info) { // chrome.ta ...

随机推荐

  1. 关于sublime3的配置笔记

    1.安装的插件有Anaconda, GitGutter, SublimeCodeIntel Anaconda会有长度超过80警报的问题, 影响写代码的时候的判断, 所以将Preferences/Pac ...

  2. 用python随机生成数据,再插入到postgresql中

    用python随机生成学生姓名,三科成绩和班级数据,再插入到postgresql中. 模块用psycopg2 random import random import psycopg2 fname=[' ...

  3. HDFS配置文件内容解释

    配置概述 hadoop-env.sh 一个可由hadoop脚本调用的bourne shell文件,它制定hadoop要用的JDK环境变量.守护进程JDK选项.pid文件和log文件夹 core-sit ...

  4. 使用QtCreator作为ROS调试器

    如果你用过QtCreator,你一定会喜欢上它. 流畅的速度,强大的功能,优雅的外观,友好的界面,一切让人如此舒服.而且它支持从命令行作为调试器启动,只需加上-debug exe即可. 因此我想如果能 ...

  5. 【转】嵌入式Linux学习笔记

    一  嵌入式系统定义: 应用于特定环境的硬件体系. 二  两样非常重要的能力: 1.  掌握各种新概念的能力 2.  调试的能力( 包括软件, 硬件 ) 三  需要的基础知识: 1.  操作系统理论基 ...

  6. BZOJ 1061 志愿者招募

    http://www.lydsy.com/JudgeOnline/problem.php?id=1061 思路:可以用不等式的改装变成费用流. 将不等式列出,如果有负的常数,那么就从等式连向T,如果是 ...

  7. iostat 离线安装

    由于lucene需要一定的io读写顾安装iostat来对磁盘io进行监控 iostat 属于sysstat下的功能 git路径如下:https://github.com/sysstat/sysstat ...

  8. 【Python脚本】Eclipse IDE扩展PyDev插件安装

    作为一名Python的初学者,其实不用太在意IDE了,我觉得开始的时候用用自带的 IDLE 也挺好的. 还有 DreamPie 也挺好的.都是一些轻量级的IDE. 因为我正好安装有Eclipse,平时 ...

  9. wxpython 布局管理

    一个典型的应用程序是由不同的部件.这些小部件被放进容器部件.一个程序员必须管理应用程序的布局.这不是一项容易的任务.在wxPython我们有两个选择. *absolute positioning*si ...

  10. python高级编程之装饰器04

    from __future__ import with_statement # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrat ...