No # used. Regular link created with standard $this->Html->link('title',
array(controller action), array(class => is_ajax)) so the js will make the
ajax request based on the class. I would just like the new content to load
into the div where the page is currently at rather than forcing the page to
the top which is annoying.

Thanks for the response.

K

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Ryan Schmidt
Sent: Monday, March 21, 2011 5:29 AM
To: [email protected]
Subject: Re: Ajax Question

On Mar 20, 2011, at 23:52, Krissy Masters wrote:

> I am loading content into a div so left menu click loads the element into
the right side.pretty simple. But how do you prevent the page from always
jumping to the top? Layout has header, intro, page title then the content
starts but everytime I click a side nav ajax link it loads the content fine
but always jumps the page back to the top.

This would be normal behavior, if you have something like:

<a href="#" onclick="somethingAjax()">click</a>

That is, href="#" means "scroll to the top".

If you don't want to scroll to the top when clicked, don't set href to "#".
Alternatives include href="javascript:void(0)" or even better just omit the
onclick attribute and put that function in the href:
href="javascript:somethingAjax()".



-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to