callback function

535 views
Skip to first unread message

Jim Larking

unread,
Dec 11, 2009, 9:47:47 AM12/11/09
to jscrollpane
Hi,

Is there a callback function that can be supplied so that once the
jscrollpane has done its business then some further javascript can be
executed following this?

I guess the syntax would be something like:

$('.custom-scrollpane').jScrollPane({dragMaxHeight:"11",
scrollbarWidth:"10"},function(){
alert('done the scrollpane now do something else');
});

if this doesn't exist then could anyone point me in the direction of
where i might be able to add such a facility and if i manage it then i
can send back for anyone else to use.

the reason i need this is so that i can resize my table headers to be
the same sizes as the newly generated table that is within the
scrollpane - i tried using another jquery plugin to have fixed headers
but it seemed to conflict with jscrollpane.

thanks

Jim

Kelvin Luck

unread,
Dec 18, 2009, 6:40:57 AM12/18/09
to jscro...@googlegroups.com
Hi Jim,

The jScrollPane call should be synchronous i.e. it should have finished
all it does directly after you've called the function. So you should be
able to just call your other javascript on the next line e.g.

$('.custom-scrollpane').jScrollPane({dragMaxHeight:"11",

scrollbarWidth:"10"});


alert('done the scrollpane now do something else');

Let me know if that doesn't work for you,

Cheers,

Kelvin :)

On Fri, 11 Dec 2009 14:47:47 -0000, Jim Larking <j...@citadelsecure.com>
wrote:

> --
>
> You received this message because you are subscribed to the Google
> Groups "jscrollpane" group.
> To post to this group, send email to jscro...@googlegroups.com.
> To unsubscribe from this group, send email to
> jscrollpane...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jscrollpane?hl=en.
>
>

Jim Larking

unread,
Dec 21, 2009, 6:23:08 AM12/21/09
to jscrollpane
Hi Kelvin,

Thanks for that. It does seem to be working as you have suggested. I
had been trying to do it with an if statment like this:

if($('.custom-scrollpane').jScrollPane({dragMaxHeight:"11",
> scrollbarWidth:"10"})){
dosomething();
}

so i guess that bypassed the synchronous effect of the script as it
wasn't quite working properly. It seemed to be an intermittent
problem depending on how fast the script executed so i'll let you know
if that hasn't fixed it in time.

thanks for your reply and thanks for the script. it is working nicely.
the project is for is for a big client so when it eventually goes live
then i'll let you know what it is (under offical secrets act at the
moment!!)

Kelvin Luck

unread,
Dec 21, 2009, 6:58:41 AM12/21/09
to jscro...@googlegroups.com
Hi,

It looks like you are expecting the jScrollPane function to return a
boolean based on whether the scrollpane was initialised or something?

It will actually return the exact same as $('.custom-scrollpane') does.
Which will be an "array like" jQuery object with zero or more elements.

I'm not sure if that makes any difference to your code?

I haven't done any testing to confirm that jScrollPane is synchronious but
from what I remember of the code it should be. I'm afraid I'm really busy
at the moment so I can't do any more tests but I hope this helps you out,

Cheers,

Kelvin :)

On Mon, 21 Dec 2009 11:23:08 -0000, Jim Larking <j...@citadelsecure.com>

Reply all
Reply to author
Forward
0 new messages