Re: Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- From: Vik Rubenfeld <vikr@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 30 Oct 2007 19:31:55 -0700
Thanks very much for this good advice, David.
Have you tried debugging this?
function ScrollToDiv(theDivID)
{
$("html,body").animate({ scrollTop: $("#"+theDivID).offset().top });
}
I got that code from a posting on a forum, and it may very well have
bugs in it. It seems to be working now. I got it all working like so:
function ScrollToDiv(theDivID)
{
$("html,body").animate({ scrollTop: $("#"+theDivID).offset().top });
}
$(document).ready(function(){
$("#HelpInfo").click(function(){
var htmlStr = $(this).html();
$("#HelpInfo").load("http://localhost:8888/index.php/your_plan/HelpInfo",
{contents: htmlStr}, function(){ ScrollToDiv("HelpInfo")});
});
});
Why not just set the location hash to test it? Then you will know the
callback worked.
I appreciate this - because it gives me something to learn about. I
don't even know what a location hash is yet. :)
What does it mean to scroll both the html and body
elements?
Good question - I'll look into it.
Does jQuery even support animated scrolling?
It does!
jQuery and Prototype and Scriptaculous? Whave are you up to in terms
of script weight? About 200K?
You're quite right. I'll make things work with just one library.
.
- Follow-Ups:
- Re: Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- From: Peter Michaux
- Re: Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- References:
- Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- From: Vik Rubenfeld
- Re: Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- From: David Mark
- Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- Prev by Date: Re: Recommendations for JavaScript drop-down menu code
- Next by Date: Re: Javascript Library
- Previous by thread: Re: Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- Next by thread: Re: Newbie jQuery Question: Ajax Load Callbacks/Using jQuery with Other jLibs?
- Index(es):
Relevant Pages
|