My script used to work. Now it doesn't. The only thing that has
changed is the hosting service. Now my scriptaculous effects are not
defined.
I'm a noob hanging off the edge of his learning curve. any help would
be greatly appreciated. I've included the troubled script. Thanks to
all in advance.
script:
//spinner function
Ajax.Responders.register({
onCreate: function(){ $('spinner').show();},
onComplete: function(){
if(0==Ajax.activeRequestCount)
$('spinner').hide();
}
});
//dynamicize function
var DynamicExtensions = {
dynamicize: function(element){
element.dHref = element.href;
element.dTarget = element.target;
element.href = "#"+element.target;
element.target = "";
element.dynamic =
dynamicallyLoad.bindAsEventListener(element);
Event.observe(element, 'click', element.dynamic);
}
}
Element.addMethods(DynamicExtensions);
function dynamicallyLoad(e) {
new Effect.Fade('content',{duration:0.5, afterFinish:function(){
element = Event.element(e);
new Ajax.Updater(element.dTarget, element.dHref, {
method: 'get',
onComplete: function() {
setLinks(element,element.dTarget);
new Effect.Appear('content', {duration:0.5,
from:0.0, to:1.0});
}
});
}});
}
function setLinks(e, target) {
(target) ? selector = '#'+target+' ' : selector = '';
$$(selector+'a.dynamic').invoke('dynamicize');
}
//link to fade function
function changeLinkToFade( el ) {
if (typeof(el) != 'object') el = $(el);
// copy the href
el.link = el.href;
el.href='#';
Event.observe(el,'click',function(event) {
new Effect.Fade($('pageContainer'),{
afterFinish:function() {
// fix the back button (make page Appear after changing the
page)
new Effect.Appear($('pageContainer'),{duration: 5});
// change the location
window.location = el.link;
return false;
}
});
return false;
});
}
function initiateLinkToFade() {
$$('a.fade').each( function( el ) { changeLinkToFade( el ); } );
}
//centering function
function center(){
var windowHeight = document.viewport.getHeight();
var containerHeight = $('pageContainer').getHeight();
$('pageContainer').style.position='relative';
$('pageContainer').style.top=((windowHeight/2)-(containerHeight/2))
+'px';
}
//hide load process
document.observe("dom:loaded",
function(){
new Effect.Opacity('pageContainer',{duration:.1,
from:1.0, to:0});
setLinks();
});
//center before appearing
Event.observe(window, 'load', function(){
center();
new Effect.Opacity('pageContainer',{duration:25, from:0,
to:1.0});
initiateLinkToFade();
});
//center on window resize
window.onresize= function(){
center();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---