Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ajax expert help needed

Status
Not open for further replies.

786snow

Programmer
Nov 12, 2006
75
Hi,

I have this site. if you click on the menue you see bottom part changes.



It is done through ajax call. If you click on the menue that says FAQ, bottom part changes asusual. What I want, i want when some one clicks FAQ and bottom part changes I want page to show question that says

"Can a tax attorney actually cut my tax burden"

So page needs to reposition itself to the middle

which we normally do when we have seperate pages(not Ajax)





<a name='qa1' id='qa1'></a>


and then the link


someone suggested me using in the content loaded by AJax



<a name="qal" id="qal"></a>

<script>
window.location='qal';


</script>


that did not reposition the page

How can I take care of this problemn as I am using Ajax, i will appreciate your help
 
Ok, you are updating the content using:

Code:
new Ajax.Updater("copy", file_name+".html.php");

After this code, use the prototype function:
Code:
Element.scrollTo('id_target_object');

This will do what you were looking for.

As a recommendation, I would lose the onclicks in the menu and replace them with Event.observer (also available in prototype).

Best of luck!

X
 
thanks for yuor reply, this

'id_target_object' is this the anchor ? like

<a name="id_target_object" id="id_target_object"></a>

secondly should that be in the content loaded by Ajax or in the main page?

 
i tried


I put

<a name='page_position1' id='page_position1'></a>

on the main page, but it does not scroll, i don't know why, i put alert to confirm if condition it geting executed , but still does not work.
 
Try changing the anchor to this:
Code:
<a id="page_position1">&nbsp;</a>

If that doesn't work, I would suggest downloading a newer version of prototype (I've been using 1.5.0_rc1 in production)

You can download it along with the scriptaculous library:


Let us know your results!

X
 
thanks a lot for your help, it works now ........ I had to put some text between to make it work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top