0
我有“的fancybox”工作作为一个模块,在那里我可以导入import fancybox from 'fancybox';
主要应用JS文件中。但是我无法工作的是'助手'js文件,它扩展了主要fancybox功能的功能。“的fancybox”全球jQuery插件与JSPM/System.js实现为模块:
JSPM的package.json覆盖部分出口“的fancybox”从主“的源极/ jquery.fancybox.pack.js”文件的功能。那么它应该由助手文件扩展。
{
"jspm": {
"configFile": "config.js",
"dependencies": {
"fancybox": "bower:[email protected]^2.1.5",
},
"overrides": {
"bower:[email protected]": {
"main": "source/jquery.fancybox.pack.js",
"format": "global",
"files": [
"source/jquery.fancybox.pack.js",
"source/helpers/jquery.fancybox-buttons.js",
"source/helpers/jquery.fancybox-media.js",
"source/helpers/jquery.fancybox-thumbs.js"
],
"shim": {
"source/jquery.fancybox.pack.js": {
"deps": [
"jquery"
],
"exports": "fancybox"
},
"source/helpers/jquery.fancybox-buttons.js": {
"deps": [
"jquery"
],
"exports": "*"
},
"source/helpers/jquery.fancybox-media.js": {
"deps": [
"jquery"
],
"exports": "*"
},
"source/helpers/jquery.fancybox-thumbs.js": {
"deps": [
"jquery"
],
"exports": "*"
}
}
}
}
}
}
主要应用entery点main.js:
import jquery from 'jquery';
import fancybox from 'fancybox';
jquery(document).ready(function() {
/*
* Simple image gallery. Uses default settings
*/
if (typeof jquery('.fancybox').fancybox !== 'undefined') {
// the variable is defined
jquery('.fancybox').fancybox();
/*
* Different effects
*/
// Change title type, overlay closing speed
jquery(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});
// ..... & other helpers and configurations.
/*
* Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
*/
jquery('.fancybox-thumbs').fancybox({
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
arrows : false,
nextClick : true,
helpers : {
thumbs : {
width : 50,
height : 50
}
}
});
} });
我不知道如何将佣工的主要功能结合起来。由于
- JSPM覆盖发电机:http://jarreddebeer.github.io/jspm-package-override-generator/public/
- 的fancybox回购:https://github.com/fancyapps/fancyBox &文档:http://fancyapps.com/fancybox/#docs
- JSPM注册表文件:https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm & http://jspm.io/0.17-beta-guide/overrides.html
- System.js全局格式https://github.com/systemjs/systemjs/blob/master/docs/module-formats.md#globals
文档吮吸这是肯定的。只是简单的例子,没有解释每个参数及其含义。 – MyUserInStackOverflow