flyingdutchie
Sep-14-2005, 11:04 AM
Hi smugmug,
In my customization i use the <body onload=""> event to execute code after the page finished loading (it creates a menu).
However, your 'slideshow' page overrides it because it contains javascript that forcefully overwrites the onload event-handler ==> My menu does not load. I got around it by doing some javascript hacking, but i'd prefer a proper solution :):
Here is a snippet of the javascript from smugmug on the 'slideshow' page that overwrites it:
onload = onStart;
captionTopHidden = true;
captionBottomHidden = true;
...
Maybe your smugmug.js scripting file could contain this piece of code:
var g_onLoadFncs = new Array();
function RegisterFunction(pFunction, pParameter)
{
this.funct = pFunction;
this.parameter = pParameter;
}
function executeOnLoad()
{
for (var i = 0; i < g_onLoadFncs.length; i++)
{
var fnc = g_onLoadFncs[i];
fnc.funct(fnc.parameter);
}
}
function registerOnLoad(pFunc, pParameter)
{
var curIndex = g_onLoadFncs.length;
g_onLoadFncs.length++;
g_onLoadFncs[curIndex] = new RegisterFunction(pFunc, pParameter);
}
The body tag must then look like this:
<body onload="executeOnLoad();">
And when some function needs to execute after the page has loaded, the registerOnLoad must be called:
function myfunction(pParm)
{ ... }
registerOnLoad(myfunction, "hello");
function myotherfunction()
{ ... }
registerOnLoad(myotherfunction);
Thank you very much.
-- Anton.
In my customization i use the <body onload=""> event to execute code after the page finished loading (it creates a menu).
However, your 'slideshow' page overrides it because it contains javascript that forcefully overwrites the onload event-handler ==> My menu does not load. I got around it by doing some javascript hacking, but i'd prefer a proper solution :):
Here is a snippet of the javascript from smugmug on the 'slideshow' page that overwrites it:
onload = onStart;
captionTopHidden = true;
captionBottomHidden = true;
...
Maybe your smugmug.js scripting file could contain this piece of code:
var g_onLoadFncs = new Array();
function RegisterFunction(pFunction, pParameter)
{
this.funct = pFunction;
this.parameter = pParameter;
}
function executeOnLoad()
{
for (var i = 0; i < g_onLoadFncs.length; i++)
{
var fnc = g_onLoadFncs[i];
fnc.funct(fnc.parameter);
}
}
function registerOnLoad(pFunc, pParameter)
{
var curIndex = g_onLoadFncs.length;
g_onLoadFncs.length++;
g_onLoadFncs[curIndex] = new RegisterFunction(pFunc, pParameter);
}
The body tag must then look like this:
<body onload="executeOnLoad();">
And when some function needs to execute after the page has loaded, the registerOnLoad must be called:
function myfunction(pParm)
{ ... }
registerOnLoad(myfunction, "hello");
function myotherfunction()
{ ... }
registerOnLoad(myotherfunction);
Thank you very much.
-- Anton.