navigation MDL-14632 Fixed Javascript scrolling bug in FF3

This commit is contained in:
samhemelryk
2009-08-31 08:27:26 +00:00
parent a0a268d5c4
commit 576ace3245
+10 -6
View File
@@ -275,7 +275,6 @@ navigation_tree.prototype.add_branch = function(branchxml, target, depth) {
* @param {element} e Event object
*/
navigation_tree.prototype.toggle_block_display = function(e) {
YAHOO.util.Event.preventDefault(e);
if (e !== null) {
YAHOO.util.Event.stopPropagation(e);
}
@@ -433,6 +432,7 @@ function navigation_tab_panel() {
this.tabpanel = null;
this.tabpanels = Array();
this.tabcount = 0;
this.preventhide = false;
this.showntab = null;
}
/**
@@ -586,11 +586,11 @@ navigation_tab_panel.prototype.resize_tab = function () {
var tabheight = parseInt(this.tabpanels[this.showntab.tabname].body.offsetHeight);
var tabtop = parseInt(this.tabpanels[this.showntab.tabname].cfg.getProperty('y'));
var titletop = YAHOO.util.Dom.getY(this.showntab.tabname+'_title');
var scrolltop = (document.all)?document.body.scrollTop:window.pageYOffset;
// This makes sure that the panel is the same height as the tab title to
// begin with
if (tabtop > 10 && tabtop > titletop) {
this.tabpanels[this.showntab.tabname].cfg.setProperty('y', titletop);
if (tabtop > (10+scrolltop) && tabtop > (titletop+scrolltop)) {
this.tabpanels[this.showntab.tabname].cfg.setProperty('y', titletop+scrolltop);
}
// This makes sure that if the panel is big it is moved up to ensure we don't
@@ -600,7 +600,7 @@ navigation_tab_panel.prototype.resize_tab = function () {
if (tabtop<10) {
tabtop = 10;
}
this.tabpanels[this.showntab.tabname].cfg.setProperty('y', tabtop);
this.tabpanels[this.showntab.tabname].cfg.setProperty('y', tabtop+scrolltop);
}
// This makes the panel constrain to the screen's height if the panel is big
@@ -631,7 +631,7 @@ navigation_tab_panel.prototype.show_tab = function (e, tabname) {
this.tabpanels[tabname].show(e, this.tabpanel);
YAHOO.util.Dom.addClass(tabname+'_title', 'active_tab');
YAHOO.util.Event.removeListener(tabname+'_sidebarpopup', "mouseover", this.show_tab);
YAHOO.util.Event.addListener('navigation_tab_panel_'+tabname, "click", function (e){YAHOO.util.Event.stopPropagation(e);});
YAHOO.util.Event.addListener('navigation_tab_panel_'+tabname, "click", function (e){this.preventhide = true}, this, true);
YAHOO.util.Event.addListener(tabname+'_sidebarpopup', "click", this.hide_tab, tabname, this);
YAHOO.util.Event.addListener(window, 'resize', this.resize_tab, this, true);
YAHOO.util.Event.addListener(document.body, "click", this.hide_tab, tabname, this);
@@ -646,6 +646,10 @@ navigation_tab_panel.prototype.show_tab = function (e, tabname) {
* @return {bool}
*/
navigation_tab_panel.prototype.hide_tab = function(e, tabname) {
if (this.preventhide===true) {
this.preventhide = false;
return true;
}
this.showntab = null;
YAHOO.util.Event.addListener(tabname+'_sidebarpopup', "mouseover", this.show_tab, tabname, this);
YAHOO.util.Event.removeListener(window, 'resize', this.resize_tab);