Skip to content
This repository was archived by the owner on Apr 16, 2019. It is now read-only.

Commit 9c6de3f

Browse files
author
Ian Maffett
committed
Merge pull request #902 from ArcRain/master
Fix No 'panelunload' event when panel removed active
2 parents 4a92b51 + e49b8c8 commit 9c6de3f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/af.ui.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,6 @@
860860
//Add the back button if it's not there
861861
if(hdr.find(".backButton").length===1) return;
862862
hdr.prepend("<a class='backButton back'>" + this.backButtonText + "</a>");
863-
//Fix device click no response issue
864-
hdr.on("click", ".backButton", function() {
865-
if(this.useInternalRouting)
866-
this.goBack(this);
867-
});
868863
}
869864
else {
870865
hdr.find(".backButton").remove();
@@ -971,11 +966,13 @@
971966
if(!back){
972967
this.classList.remove("active");
973968
//If 'this' is view, then find active panel and remove active from it
974-
var activePanel = $(this).find(".active").get(0);
975-
if (undefined !== activePanel) {
976-
activePanel.classList.remove("active");
969+
var tmpActive = $(this).find(".active").get(0);
970+
if (undefined !== tmpActive) {
971+
$(tmpActive).trigger("panelunload", [back]);
972+
tmpActive.classList.remove("active");
977973
}
978-
$(this).trigger("panelunload", [back]);
974+
//Below trigger will be called when 'to animation' done
975+
//$(this).trigger("panelunload", [back]);
979976
}
980977
else{
981978
this.classList.add("active");
@@ -1001,6 +998,7 @@
1001998
//Fixes #850, #860, #873
1002999
var tmpActive = $(hide).find(".active").get(0);
10031000
if (undefined !== tmpActive) {
1001+
$(tmpActive).trigger("panelunload", [back]);
10041002
tmpActive.classList.remove("active");
10051003

10061004
}
@@ -1012,9 +1010,10 @@
10121010
}
10131011
this.classList.remove("active");
10141012
//If 'hide' is view, then find active panel and remove active from it
1015-
var activePanel = $(this).find(".active").get(0);
1016-
if (undefined !== activePanel) {
1017-
activePanel.classList.remove("active");
1013+
var tmpActive = $(this).find(".active").get(0);
1014+
if (undefined !== tmpActive) {
1015+
$(tmpActive).trigger("panelunload", [back]);
1016+
tmpActive.classList.remove("active");
10181017
}
10191018
$(hide).trigger("panelload", [back]);
10201019
$(hide).addClass("active");

0 commit comments

Comments
 (0)