[jQuery] animations on textarea

2009-01-31 Thread jk

Hi guys.

There is some reasonable code in the jquery.fx module which stops to
be reasonable when working with textareas.

1. jQuery.fx.prototype.update
It changes display to 'block', which may not be good for textareas.
I've made this workaround and you might want to add this 'inline'
option (or something more unified) too.

$.fx.prototype.originalUpdate = $.fx.prototype.update;
$.fx.prototype.update = false;
$.fx.prototype.update = function () {
if (!this.options.inline) return this.originalUpdate.call(this);
if ( this.options.step )
this.options.step.call( this.elem, this.now, this );
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)
( this );
};


2. jQuery.fn.animate

if ( opt.overflow != null )
 this.style.overflow = "hidden";

Again, on textarea you shouldn't change overflow property in order to
"Make sure that nothing sneaks out".
No option needed for this.

Thanks guys. Hope to see these issues solved in the next release.


[jQuery] Load (AJAX) callback after javascript evaluations

2008-05-14 Thread jk

JQuery.load can receive a callback function as one of its parameters.
According to the online docs, this function is called "when the ajax
request is complete". In practice, it appears this callback is
performed after the ajax request is complete and after the dom is
inserted, but before new javascript in the HTML is evaluated. Is there
a way to set a callback for after the javascript is evaluated?

For example:
index.html contains:


   
  
  
 $(document).ready(function(){
$("#loadindex").click(function(){
  $(this).hide();
  $("#loaddiv").load("index2.html", { game : 'lnb' }, function() {
 //alert("ajax done");
 // The next line will fail with "markLoaded" undefined.
 // However, if the previous "alert()" call is uncommented,
 // effectively adding a delay, markLoaded() is defined and
 // successfully called.
 markLoaded();
  });
});
 });
  
   
   
  Click to load Index 2
  
   



index2.html contains:

 
   
  
  
 function markLoaded() {
$(".loadingstatus").html("loaded");
 }
  
   
   
  Index 2 loading