이것이 합법적인지는 확실하지 않지만 dojox.fx.scroll 코드를 가져 와서 위에서 언급 한 '오프셋'기능을 추가했습니다 (필자도 필요함).
Chrome 디버거를 사용하여 dojox.fx.scroll 코드를 가져 와서 내 스크립트 폴더의 새로운 .js 파일에 붙여 넣기 시작했습니다.
'정의'문자열의 이름을 dojox/fx/scroll에서 dojox/fx/scrollMod로 변경했습니다. 또한 참조를 .smoothScroll에서 .smoothScrollMod로 변경했습니다.
<script src="scripts/dojoScrollMod.js" type="text/javascript"></script>
그리고 마지막으로 호출 :
var dx = 0; //RW Custom Offsets
var dy = 0; //RW Custom Offsets
if (_8.offset) {
dx = _8.offset.x;
dy = _8.offset.y;
}
이 그럼 당신은 정상적인 스크립트와 같은 HTML 파일에서이 파일을 참조 :
define("dojox/fx/scrollMod", ["dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/fx",
"dojox/fx/_base", "dojox/fx/_core", "dojo/dom-geometry", "dojo/_base/sniff"],
function (_1, _2, _3, _4, _5, _6, _7) {
_1.experimental("dojox.fx.scroll");
var fx = _2.getObject("dojox.fx", true);
_4.smoothScrollMod = function (_8) {
if (!_8.target) {
_8.target = _6.position(_8.node);
}
var dx = 0; //RW Custom Offsets
var dy = 0; //RW Custom Offsets
if (_8.offset) {
dx = _8.offset.x;
dy = _8.offset.y;
}
var _9 = _2[(_7("ie") ? "isObject" : "isFunction")](_8["win"].scrollTo),
_a = { x: _8.target.x + dx, y: _8.target.y + dy };
if (!_9) {
var _b = _6.position(_8.win); _a.x -= _b.x; _a.y -= _b.y;
}
var _c = (_9) ? (function (_d) { _8.win.scrollTo(_d[0], _d[1]); }) : (function (_e) { _8.win.scrollLeft = _e[0]; _8.win.scrollTop = _e[1]; });
var _f = new _3.Animation(_2.mixin({ beforeBegin: function() {
if (this.curve) { delete this.curve; }
var _10 = _9 ? dojo._docScroll() : { x: _8.win.scrollLeft, y: _8.win.scrollTop };
_f.curve = new _5([_10.x, _10.y], [_10.x + _a.x, _10.y + _a.y]);
}, onAnimate: _c
}, _8));
return _f;
};
fx.smoothScrollMod = _4.smoothScrollMod; return _4.smoothScrollMod;
});
나는하여 _4.smoothScrollMod 방법에 다음과 같은 추가 (평상시처럼 오프셋 된 객체를 사용하면됩니다.)
var sm = new dojox.fx.smoothScrollMod({
node: dojo.query("mySelector")[0],
win: window,
easing: dojo.fx.easing.quadInOut,
offset: { "x": 0, "y": -200},
duration: 800
}).play();
설명 : 내 사용자 층은 XP에서 100 % IE7입니다 (제 아이디어는 아닙니다). – Bitwize