想法是加载页面/something/index.html.但是,在我展示之前,它的依赖关系(在这种情况下是css和图像)是预加载的.
Modernizr.load({
load: ['/something/styles.css', '/something/image1.jpg'],
complete: showFile
});Run Code Online (Sandbox Code Playgroud)
我查看了Paul Irish的"imagesLoaded"jQuery插件,但我更喜欢使用我已经拥有的加载器的简单性.我知道YepNope(和Modernizr.load)不是设计师作为通用预加载器,但我觉得这是最干净的方法.
非常感谢有关如何将图像预加载到Modernizr/YepNope加载脚本中的任何想法.
新西兰
我想从Feedburner的API中获取XML feed.这只是在Excel中编写URL并使用"From Web"数据连接的问题.
这工作正常(并且非常快).
现在,我希望能够更新"日期"表中的两个单元格,以便拉出该范围的数据.这是使用URL中的参数完成的:
https://feedburner.google.com/api/awareness/1.0/GetItemData?uri=RSSFEEDNAME []
使用Excel UI,我可以将[]分配给任何单元格.但是,无论我尝试什么,这都行不通.我最初认为日期格式可能存在一些问题,所以我已经完成了我进入单元格的位置,确切的副本(&dates = 2011-08-01,2011-08-05)作为文本.
每次,Feed仅使用当前天数数据(当没有指定日期时这是默认行为).它没有给出错误(它会对相对较小的违规行为,例如没有两位数的月份),这让我觉得它只是没有用指定的文本替换[].我也使用相同的方法进行WebTrends Web服务查询,并获得同样令人沮丧的结果.我已经阅读了关于Web查询的每个方法,我正在完全遵循它们.
我找不到任何地方可以看到Excel要求的最终URL,所以在黑暗中它有点像镜头.对下一步的任何想法将不胜感激!
最好的,内森
有两个按钮可以切换项目的布局。当单击任一按钮时,我希望该项目淡出,更改然后再淡入。
使用ReactJS,我遇到了两个问题:
使用componentDidUpdate触发“淡入”事件会导致循环。不断改变状态会再次触发componentDidUpdate。
使用componentWillReceiveProps允许我更新元素上的类以使其淡出,但它也立即更改布局。我需要将更改延迟到看不见为止。
有什么想法吗?我搞错了吗?
(下面的代码,但是在JSFiddle中可以使用的Stack版本中有些问题:https ://jsfiddle.net/nathanziarek/69z2wepo/15009/ )
var Hello = React.createClass({
getInitialState: function() {
return { visible: " x-hidden" };
},
render: function() {
return <div className={"hello" + this.state.visible}>Hello {this.props.name}</div>;
},
componentDidMount: function(){
this.setState({ visible: "" })
},
componentWillReceiveProps: function(){
// The item is changing, make it invisible
// Wait until it's done being invisible before changing
// anything?
this.setState({ visible: " x-hidden" })
},
componentDidUpdate: function(){
// The item has changed, …Run Code Online (Sandbox Code Playgroud)上面的JSFiddle是为解释这个问题而设立的.但是,基本上:
HTML:
<breadcrumb></breadcrumb>
<div ng-view></div>
Run Code Online (Sandbox Code Playgroud)
角度指令和路由:
angular
.module('app', [])
.directive('breadcrumb', function() {
return {
restrict: 'E',
template: "<ul class='breadcrumb'><li ng-repeat='node in path'><a ng-href='{{node.url}}'>{{node.label}}</a></li></ul>",
replace: true,
controller: Ctrl1
}
})
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
template: '<h1>{{pgTitle}}</h1>',
controller: Ctrl2
});
}]);
Run Code Online (Sandbox Code Playgroud)
控制器
function Ctrl1($scope) {
$scope.path = [{
label: 'Home',
url: '#/'}];
$scope.pgTitle = "Home"
}
function Ctrl2($scope, $routeParams) {
$scope.path = [{
label: 'Home',
url: '#/'},{
label: 'Node 2',
url: '#/node2'}];
$scope.pgTitle = "Node 2"
}
Run Code Online (Sandbox Code Playgroud)
我希望 …