full-background.js
$(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的更多相关文章
- chrome插件background.js 和 popup.js 交互
要实现background.js 和 popup.js 之间的交互,首先需要先配置好 manifest.json文件,如: "background":{ //"page& ...
- metamask源码学习-background.js
这个就是浏览器后台所进行操作的地方了,它就是页面也区块链进行交互的中间部分. metamask-background描述了为web扩展单例的文件app/scripts/background.js.该上 ...
- Node.js异步处理CPU密集型任务
Node.js异步处理CPU密集型任务 Node.js擅长数据密集型实时(data-intensive real-time)交互的应用场景.然而数据密集型实时应用程序并非仅仅有I/O密集型任务,当碰到 ...
- 转:Node.js异步处理CPU密集型任务的新思路
原文来自于:http://www.infoq.com/cn/articles/new-idea-of-nodejs-asynchronous-processing-tasks?utm_source=i ...
- vue的测试(Vue.js devtool)
1. 安装chrome插件:Vue.js devtools(https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejigli ...
- vue-devtools(vue 2.0)手动安装与使用 ? 如何处理Vue.js is detected on this page ?
vue-devtools手动安装与使用 一.在github上下载压缩包,github下载地址:https://github.com/vuejs/vue-devtools 二.解压到本地的某盘 三. ...
- 【转】利用 three.js 开发微信小游戏的尝试
前言 这是一次利用 three.js 开发微信小游戏的尝试,并不能算作是教程,只能算是一篇笔记吧. 微信 WeChat 6.6.1 开始引入了微信小游戏,初期上线了一批质量相当不错的小游戏.我在查阅各 ...
- Chrome插件开发,美化网页上的文件列表。chrome-extension,background
上一篇文章 通过“content-scripts”的方式向页面注入js和css来美化页面,但是有一个弊端:一旦配置好需要注入的页面,之后如果这个页面地址以后发生变化,或者要新加一些URL进来,那么得修 ...
- metamask源码学习-ui/index.js
The UI-即上图左下角metamask-ui部分,即其图形化界面 The MetaMask UI is essentially just a website that can be configu ...
- js:浏览器插件
1.chrome background.js //chrome.webRequest.onBeforeRequest.addListener(function(info) { // chrome.ta ...
随机推荐
- 异步编程设计模式Demo - AsyncComponentSample
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.C ...
- nodejs+express Mvc站点
nodejs+express Mvc站点 像asp.net Mvc一样开发nodejs+express Mvc站点 首先,我是个c#码农.从事Mvc开发已然4个年头了,这两年前端MVC的兴起,我也跟风 ...
- Effective Java2读书笔记-类和接口(三)
第17条:要么为继承而设计,并提供文档说明,要么就禁止继承 第18条:接口优于抽象类 这两条中,提到了一个很重要的概念骨架实现.也就是说,抽象类实现接口的形式.这样的好处是,接口本来不能提供默认的实现 ...
- Android setTextColor无效_安卓setTextColor()的参数设置方式
通过代码setTextColor时.如果color是一个资源文件 会set失败 没有效果 遇到这样的情况有两种解决办法.亲测过.两种都是有效的 一.注解方式 通过在方法上面添加注解解决问题 代码如下 ...
- cf448B Suffix Structures
B. Suffix Structures time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 解决Struts2.2.20版本的标签不支持style属性的问题
我先把Exception错误信息贴出来:org.apache.jasper.JasperException: /WEB-INF/jsp/topicAction/addUI.jsp (line: 40, ...
- android滑动基础篇 - 触屏显示信息
效果图: 代码部分: activity类代码: package com.TouchView; /* * android滑动基础篇 * */ import android.app.Activity; i ...
- How to uninstall (remove) JAVA from OS X Lion
Open terminal (Applications -> Utilities -> Terminal) To remove JVM enter folowing: sudo rm -r ...
- 【COCOS2DX-对28游戏开发】 Cocos2d-x-3c 道路设计 CocosBase CocosNet CocosWidget
原文链接:http://blog.csdn.net/cocosviva/article/details/18970717 另一个比較不错的cocos2dx扩展库:https://github.com/ ...
- 解决Xcode6.4安装插件后插件不能使用的问题
下面是上网查的方法,综合了一下,亲测 原因: 苹果要求加入UUID证书从而保证插件的稳定性. 解决方法: 一.查看Xcode的UUID 在终端执行 defaults read /Application ...