Some questions:
I want to hide the object while it loading and show it when it load
completely, it could be something like that, or I´m totally wrong:
<script type="text/javascript">
Object.extend(Event, {
_domReady : function() {
if (arguments.callee.done) return;
arguments.callee.done = true;
if (this._timer) clearInterval(this._timer);
this._readyCallbacks.each(function(f) { f() });
this._readyCallbacks = null;
},
onDOMReady : function(f) {
if (!this._readyCallbacks) {
var domReady = this._domReady.bind(this);
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", domReady, false);
/*...@cc_on @*/
/*...@if (@_win32)
document.write("<script id=__ie_onload defer
src=javascript:void(0)><\/script>");
document.getElementById("__ie_onload").onreadystatechange =
function() {
if (this.readyState == "complete") domReady();
};
/*...@end @*/
if (/WebKit/i.test(navigator.userAgent)) {
this._timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) domReady();
}, 10);
}
Event.observe(window, 'load', domReady);
Event._readyCallbacks = [];
}
Event._readyCallbacks.push(f);
}
});
function lastSpy() {
var target = $('imagen');
if (!target) return false;
new Ajax.PeriodicalUpdater(target,
'http://localhost:3000/',{frequency:'1'})
}
Event.observe(window, 'load', lastSpy, false);
</script>
<div id="imagen" style='display: none;'>
<%=image_tag("/guarrada/Debug/foto.jpg") %>
</div>
Event.onDOMReady(function() {
$('imagen').show();
})
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en.