Jump to content


Photo

old results sliding out, new ones sliding in

jquery ajax

  • Please log in to reply
6 replies to this topic

#1 1internet

1internet

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 24 January 2013 - 01:39 PM

I have a search results page, and when someone clicks on the next link, or a higher page number, I want the current results to slide out to the left, whilst the new ones slide in from the right. Then if someone clicks on previous or a lower page number I want the current results to slide out to the right, and the new ones to slide in from the left.

Also if possible can it change the url when the new results come in?

I want to use jquery, and was wondering what is the best way to do this, would it be using animate? I have tried but cant seem to work it out.

#2 Xaotique

Xaotique

    Advanced Member

  • Members
  • PipPipPip
  • 558 posts
  • LocationPennsylvania, United States
  • Age:21

Posted 24 January 2013 - 01:59 PM

With jQuery, you would use Ajax and get the page loaded, put the return content in a DIV and use CSS to position it off the screen. Then just use $.animate() and move them to their locations. After moving it, you may want to actually put the content there (remove the style for location) so it doesn't pop out of it's place when someone resizes the browser.

Remember to remove the old data or you'll end up with a huge amount of data depending on what you're going through.

#3 1internet

1internet

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 24 January 2013 - 02:21 PM

Can the url be updated too?

#4 Xaotique

Xaotique

    Advanced Member

  • Members
  • PipPipPip
  • 558 posts
  • LocationPennsylvania, United States
  • Age:21

Posted 24 January 2013 - 03:23 PM

You don't change the URL like that. If you could, phishing sites would be quite a bit scarier than they are now. lol If you want the URL to change, you would have to reload the page.

#5 1internet

1internet

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 25 January 2013 - 10:45 PM

That's not true, you can change the url without reloading, but I am not sure how it is done.

#6 trq

trq

    Advanced Member

  • Administrators
  • 30,996 posts
  • LocationSydney, Australia.

Posted 25 January 2013 - 10:56 PM

That's not true, you can change the url without reloading, but I am not sure how it is done.


Indeed you can change the url. You do so with the history object's pushState() method. Google it.

Also, check out the fantastic library history.js https://github.com/balupton/History.js

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#7 Xaotique

Xaotique

    Advanced Member

  • Members
  • PipPipPip
  • 558 posts
  • LocationPennsylvania, United States
  • Age:21

Posted 26 January 2013 - 10:14 AM

First thing that came to mind is he wanted to change the domain, though I've never used that. Interesting .. And would that add to the history, allowing you to go back through cached versions of the page?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com