Witam, czy ktoś z was może mi pomóc w stworzeniu skryptu, który wymienia zawartość DIVa AJAXem, w taki sposób, aby nie było żadnego "skakania".
Przez skakanie rozumiem przesuwanie treści pod DIVem kiedy nowa zawartość zajmuje mniej, albo więcej miejsca.
Próbowałem wykorzystać scriptaculous :
<script type="text/javascript"> <!--
Effect.Updater = Class.create();
Object.extend(Object.extend(Effect.Updater.prototype,
Effect.Base.prototype), {
initialize: function(element) {
this.element = $(element);
var options = Object.extend({
duration: 0.001,
newContent: ''
}, arguments[1] || {});
this.start(options);
},
loop: function(timePos) {
if(timePos >= this.startOn) {
Element.update(this.element,this.options.newContent);
this.cancel();
return;
}
}
});
function updateSolutionsList(intProblemId)
{
new Effect.Fade('solutionsList', {queue : 'end'});
new Effect.Updater('solutionsList', {newContent : $('Ajax-Loader').innerHTML, queue : 'end'});
new Effect.Appear('solutionsList', {queue : 'end'});
new Ajax.Request('/Solutions/index/'+intProblemId, {
onComplete: function (response) {
new Effect.Fade('solutionsList', {queue : 'end'});
new Effect.Updater('solutionsList', {newContent : response.responseText, queue : 'end'});
new Effect.Appear('solutionsList', {queue : 'end'});
}
});
}
//-->
Wszystko niby ładnie, ale potrzebuje jeszcze płynnego efektu do zmiany wysokości DIVa.