admin 发布的文章
(function (factory) {
if (typeof define === "function" && define.amd) {
define([ "jquery" ], factory);
} else {
factory(jQuery);
}
}(function ($) {
$.fn.slides = function (options) {
var settings = $.extend({
- 阅读剩余部分 -
因为嫌console.log()的写法太繁琐,想将其简写为log()。 我最初是这样写的: var log = console.log;
log(..);
结果输出为:TypeError: Illegal invocation
谷歌一番之后在Stack Overflow上找到这个答案:var log = console.log.bind(console);
看到这个答案后,突然眼前一亮,因为我恰好刚刚在《You Don't Know JS》系列中读到过相关内容。虽然SO上只有答案没有解释,但是读过的内容瞬间在大脑中盘旋,帮我理解了这种写法的原理。刚刚学过的内容派上了用场,- 阅读剩余部分 -
jspm init初始化会报错,研究了一下午,因为原来一直好好的,错误信息:err TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
如图: 研究了一下午啊,发现原来是后期本地安装git以及用git创建了项目造成了在git时需要配置用户名密码才能正常下载数据:配置命令:jspm registry config github
然后在jspm init 就正常了
http://photoswipe.com/documentation/api.html所有的方法和这个网页上列出的属性是公开的。如果你想看看例子什么API可以做的,拿在默认PhotoSwipe UI源看看。您可以初始化,例如在得到PhotoSwipe实例对象:var photoswipeInstance = new PhotoSwipe( /* ... */ );
Methodsvar pswp = new PhotoSwipe( /* ... */ );
// Initialize and open gallery
// (you can bind events be- 阅读剩余部分 -
配置选项是在键 - 值对添加作为参数传递给PhotoSwipe构造,例如通过:var options = {
index: 3,
escKey: false,
// ui option
timeToIdle: 4000
};
var gallery = new PhotoSwipe( someElement, PhotoSwipeUI_Default, someItems, options);
gallery.init();
// Note that options object is cloned during the initiali- 阅读剩余部分 -
- « 前一页
- 1
- ...
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- ...
- 74
- 后一页 »