我使用英特爾的AppFramework,我有這樣的代碼:如何在幻燈片轉換中添加'返回'參數?
<div title="welcome" id="login" class="panel" selected="true">
<!-- some code here -->
<a href="#register" class="soc-btn gray-btn left" data-transition="slide">Sign Up</a>
<!-- some code here -->
</div
<div title="register" id="register" class="panel">
<!-- some code here -->
<a href="#login" class="soc-btn gray-btn left" data-transition="slide">Cancel</a>
<!-- some code here -->
</div>
從#login過渡到#register像一個魅力的作品,由右到左加載頁面。 但是如何應用'回退'轉換使#register上的'取消'按鈕加載#login 從左到右?
我看到UI /轉換/ all.js文檔:
Initiate a sliding transition. This is a sample to show how transitions are implemented.
These are registered in $ui.availableTransitions and take in three parameters.
@param {Object} previous panel
@param {Object} current panel
@param {Boolean} go back
@title $ui.slideTransition(previousPanel,currentPanel,goBack);
但如何添加 'GoBack的' 參數到我的代碼?謝謝
這裏的幻燈片過渡的完整代碼:
(function ($ui) {
/**
* Initiate a sliding transition. This is a sample to show how transitions are implemented. These are registered in $ui.availableTransitions and take in three parameters.
* @param {Object} previous panel
* @param {Object} current panel
* @param {Boolean} go back
* @title $ui.slideTransition(previousPanel,currentPanel,goBack);
*/
function slideTransition(oldDiv, currDiv, back) {
oldDiv.style.display = "block";
currDiv.style.display = "block";
var that = this;
if (back) {
that.css3animate(oldDiv, {
x: "0%",
y: "0%",
complete: function() {
that.css3animate(oldDiv, {
x: "100%",
time: $ui.transitionTime,
complete: function() {
that.finishTransition(oldDiv, currDiv);
}
}).link(currDiv, {
x: "0%",
time: $ui.transitionTime
});
}
}).link(currDiv, {
x: "-100%",
y: "0%"
});
} else {
that.css3animate(oldDiv, {
x: "0%",
y: "0%",
complete: function() {
that.css3animate(oldDiv, {
x: "-100%",
time: $ui.transitionTime,
complete: function() {
that.finishTransition(oldDiv, currDiv);
}
}).link(currDiv, {
x: "0%",
time: $ui.transitionTime
});
}
}).link(currDiv, {
x: "100%",
y: "0%"
});
}
}
$ui.availableTransitions.slide = slideTransition;
$ui.availableTransitions['default'] = slideTransition;
})(af.ui);