No I do not want the page to “jump” the page has header block about 250px high so when user is visiting the site you will have to scroll down the page to get to the ajax link that when clicked loads content into a div right beside it. So when it gets click the page jumps up to the top forcing the user to once again scroll down to where they were. I do not want anything to move.
From: [email protected] [mailto:[email protected]] On Behalf Of Qu xiaowei Sent: Monday, March 21, 2011 11:27 AM To: [email protected] Subject: Re: Ajax Question i'am not sure i've really understood your question. if you just want to make the content to top. you could get the top attribute of the content. then asign it to the page offset.it's easy to get this effect with JQuery. like this var v = $('#pageCore').offset().top; $(document).scrollTop(v); is that right?wish that would help 2011/3/21 Krissy Masters <[email protected]> I have stripped everything out to barebones pretty much to see if it was something in the code but this below still makes the page jump (FF / IE / Chrome that I tested in) $("a.is_ajax").live('click',function(e) { var page_url = $(this).attr("href"); e.preventDefault(); $.ajax({ type: "get", url: page_url, success: function(response){ $('#pageCore').html(response); } }); return false; }); -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Ryan Schmidt Sent: Monday, March 21, 2011 7:35 AM To: [email protected] Subject: Re: Ajax Question On Mar 21, 2011, at 04:41, Krissy Masters wrote: > 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. Hmm. What is the JavaScript code that transforms your is_ajax-classed links? -- 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 -- 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
