Hello. I'm Scott Robbin. I enjoy making things to use, and see.

07 Jan 09 

jQuery pageSlide

Nowadays, it might be accurate to say that screen real estate is worth more than actual real estate.

As web developers, we spend precious time laying out our pages, using every UI concept in the book to conserve space, while trying to maintain a user's focus on the task at hand. There are many techniques to use — Lightbox, Carousel and Tabs to name a few — and today I hope to offer up another: jQuery pageSlide.

jQuery pageSlide was inspired by the UI work of Aza Raskin. In his recent posts regarding concepts for Firefox Mobile and a mouse-based Ubiquity, Aza introduced the idea of sliding (or "throwing") content aside to reveal a secondary content pane.

jQuery pageSlide Screenshot

This plugin allows any developer to recreate a similar interaction on their own website using a few simple lines of Javascript. By attaching the method to an anchor tag, pageSlide wraps the original body content into a wrapper and creates an additional block for the secondary content load. The slide is animated whenever the click event is invoked.

<script type="text/javascript">
    $(document).ready(function() {
        $('a.pageslide').pageSlide({
            width: "300px"
        });
    });
</script>

Similar to Lightbox, pageSlide has two major advantages:

  1. The primary window is reserved for content; secondary interactions do not require additional space on the page — the area they need is created and removed on demand.
  2. Because the user can see the original window, they have a greater likelihood of retaining focus, and can easily return to the previous task.

Can I See It In Action?

Of course, you can! Click for a pageSlide demo.

Where Do I Get It?

I've setup a GitHub project for jquery-pageslide. Note: It's just a rough outline of how the plugin should function and in not production-ready yet. I've intentionally left it as a simple skeleton so that others may participate in the design and implementation process. Comments and suggestions, either here or on the project page, are welcome and appreciated.

 
  1. Great plugin, Im thinking to use it in a future web site. Thanks.

  2. rory says:

    Poppycock indeed!

    On the other side of the big pond here but very impressed nonetheless. I’ve seen a lot of plugins that slide over boxes of content, but never the whole page. I like this idea!

  3. Really neat. Thank you.

  4. I will definitely keep an eye on the project. It looks really useful and I’m probably going to use it in the future.

  5. It’s nice to have another UI convention for supplemental information available for use where appropriate. As for returning to the main content, it could be more intuitive if a thin expand/contract button was at the division between the page and the sidebar as an alternate means to close it. Something like the one seen in this screengrab:
    http://cannonballinteractive.com/temp/expand_ui.gif

    The plugin could potentially allow developers to specify whether the sidebar goes off screen completely when closed (as it does now) or leaves that thin strip visible.

  6. Jim Jeffers says:

    How do you revert from the page slide? When you try the demo out it you can’t go back without refreshing. Is it as easy as setting a link with certain class? Very cool though – the way the page slides off to the side is pretty slick. Have users been reacting to it well? Neat stuff thanks for releasing!

  7. Brenelz says:

    Very neat effect!

  8. pedalpete says:

    I just found this on hackernews, after spending last night writing a script that does almost the exact same thing.

    My next chore was to figure out how to have the slid-wrap as scrollable content.
    Any ideas on that one?
    Of course, it needs to be fixed initially so that when the user slides, you aren’t half way down the slide page, but what I’m thinking of doing is to swap the fixed position to the main body, and then allow the slide to be scrolled.

  9. Rodrigo says:

    cool! :)

  10. grosser says:

    Nothing happening on the demo page…
    (FF3/Ubuntu)

  11. fmvilas says:

    Nice!!

    It can be very useful!

    Fran.

  12. Phunky says:

    Im shocked at how well this works, it feels right – the slide draws your attention to the desired area and you click back on the content to carry on.

    The reason why im shocked is that it’s just a glorified show/hide side panel – but the key thing is the slide animation of the main content that’s what takes your attention.

    Lovely work!

  13. Serge says:

    I will definitely put this to use, as such adding short brief notes i have in my app.

    Thank you so much.

  14. david says:

    Awesome jQuery plugin.

    There is a tiny bug it it though. If the browsers height is less than that of the content in the slide out there is no way to scroll that content (only the main content). I am not sure an easy fix. This seems to be a problem with a lot of the page level animation plugins.

    Tested in FF 3.0.5 on Ubuntu 8.04 on this page with a browser hight of about 150px.

  15. Amir says:

    Wow this is cool!

  16. Weston Ruter says:

    This is a really innovative effect. I wonder, instead wrapping the body content with a DIV and then setting it to position:relative and then giving it a negative left position. Could you instead set a negative left margin? I was playing around with it in Firebug and it seemed to work well. If you could use negative margin-left instead, it would make it much easier to implement since it could be dropped in without needing extra container markup. You may have already tried this, however.

  17. George says:

    Scott,

    Looks very interesting, thanks for the plugin!
    Btw, its working perfectly locally, but the demo page points to the “secondary_page”.

    -gc

  18. John says:

    This is excellent! Definitely a pleasant way to display help content, for example.

    One thing you may want to consider is delaying the panel from sliding in until the ajax content is loaded and, in the meantime, add the option to append a spinner to the link (or some other loading indication).

    Other than that additional functionality, I think you’ve got yourself a winner!

  19. Elijah Grey says:

    The demo doesn’t seem to work for me in Win32 Firefox 3.0.5.

  20. d00d says:

    Pageslide demo is not working for me in Firefox 3.

  21. d00d says:

    Never mind. The page has to completely load or you get the contents of the hidden column in a separate page. The woes of dialup.

  22. Personally, I’d call it “shenanigans”. :)

  23. Joe McCann says:

    Very interesting concept. Stoked to see how folks integrate this into their sites.

  24. eric fickes says:

    That’s smooth!

  25. Buck Wilson says:

    Ha, nice impactful effect. When posting a jQuery plug in, it’s helpful to outline the options and what they do.

    Additional options that might be helpful:
    Toss in a jQuery selector for a “close” button within the panel that slides in.
    Disable clicking on body to close the slider
    The direction the slider comes from

    I’ll try and poke around with it, but I always feel bad editing someone else’s code :P

  26. Danny Croft says:

    Love it! Clean & Simple.

  27. Preston Hall says:

    Hey, this is great stuff. I see a lot of potential for it, especially for opening image photo and art galleries on my site.

    Questions……
    How do you make the page slide down from the top or the bottom or left side of the browser window? I checked out the code download you provided but do not see any instructions or variables on changing these things. I am not a coder, but know just enough about copying and pasting code and making tweaks to get things right. Are there tweaks to making this happen?

    Thanks
    Preston

  28. Juan says:

    Nothing appearing for me – Mac OS X Leopard, FF 3.0.5, All scripts enabled.

  29. I see a major flaw with this… if you click before the page loads then you have a real problem. I guess this is the same for all jQuery cos of the documentLoad… but it’s something we need to think about with page load times + amount of content + graphics!

  30. Steve Mulder says:

    Cool, but isn’t there a way to slide it back?

  31. Brice says:

    I like the effect. Do you plan on adding history/back button support to slide back?

  32. Samyak says:

    It looks like the demo is not working. I found no javascript in the page.

  33. Ruby Blye says:

    Didn’t do anything.

  34. Vlad says:

    I like the effect, but how is this better than just sliding out the side panel above the existing content? That is, not pushing content to the left beyond the view of the user, but rather just covering content on the right with a sliding/fading block?

  35. Ashwin says:

    Nice work…
    Well..Few ideas we can slide the secondary content up,down,left,right…

  36. Olly Willans says:

    Nice idea Scott, I could definitely see us using it.

  37. Denis says:

    Nice thing. But it looks buggy in iPhone Safari browser. (When clicked sliding panel appears on top of the page) If it could be fixed for that platform it might be a must have feature.

  38. Diego says:

    Very impressive work Scott! I will add to my UI belt.

    Just one thing, when trying first time I failed at finding the way to return to the main content area. After a few seconds I clicked on it and I got back to it.

    Maybe some sort of visual clue for users to go back could help.

    Cheers,

  39. Shubhamoy says:

    Hi Admin,

    This is really amazing for displaying ads or some important content. I will surely use this on my new website.

  40. ash says:

    doesn’t work ff3 pc

  41. Not so complex
    But usefull.
    That’s what I am searching. Tahkns.

  42. Matt Wilcox says:

    The demo you have linked to seems to be simply the secondary “pane” and not the demo itself?

    Nice idea, I’ve been wanting to do this with complete pages (ie., and AJAX call for the previous and next page in a URL schema) and I’m intrigued to know if this might be adapted for that purpose.

  43. Matt Wilcox says:

    Oh no, my bad, I’d got JS disabled after testing a page, sorry!

    Nice plugin :)

  44. mcm says:

    No workie in ie(6)

    works great in firefox.

  45. Spir says:

    Nice plugin. Interesting to setup options for page display (in my case).
    I was wondering how could I close the slide manually?

    Do I have to call _closeSlide?

    By the way I tried to set this on my app but the content of the “page slide” went at the bottom of the page. I have to set some CSS?

    I think I had some conflict with other plugin. The firebug-http-observer.js displayed the GET of JS script (in FIrebug console) and I had 2 errors in my code.
    If I remove the script call : $(‘a.pageslide’).pageSlide({ …}); everything is fine.

    My app is a rich backend. I use :

    jquery.form-minified
    jquery-jtemplates
    ui.datepicker-minified
    jquery.cluetip
    jquery.livequery.min
    jquery.contextmenu.r2.packed
    jquery.tablednd_0_5
    jquery.pagination.js
    jquery.pageslide-0.2
    jQuery thickbox

  46. Rupin Chheda says:

    I would really like to have configuarble options for slide in any random direction.

  47. Markus says:

    nice plugin
    very useful

  48. Jason says:

    score. I like it and will use it in a photographer’s gallery type thing.

  49. That was awesome! Great work, I could use that!

  50. Felix says:

    Great!

  51. Todd W says:

    Hello,

    The transition is really jumpy and it pushes the main content off of the left of the window.

    Thank you,

    Todd W.

  52. javo says:

    very nice, tnks for your tip

  53. Kieran says:

    Awesome design. Great work!

  54. Richard says:

    This is awesome I have a feeling we are going to see it every where in a little while. Neat post.

  55. Matt says:

    Great job it’s pretty sleek. Have to say that I had to click a couple of times around to return to the main area, not really sure what to suggest but overall its a great idea, Thanks for sharing!

  56. Chocksy says:

    It looks nice only i think that you should make it get over the main content. It’s kind of weird that it moves everything to fit that other box in there.

  57. Noura Yehia says:

    Thanks for this nice plugin.
    Could you please update the demo page, as it don’t have the example.

  58. Shane says:

    That’s pretty neat. I can think of so many potential uses for it. I’ll have to keep this in mind while designing now :)

  59. Manish Bansal says:

    Hey its very nice Piece of code!!!
    I am really very impressed congrats!!!

  60. Robin says:

    Except that this page is horribly broken in IE6 :(

  61. Dave says:

    Something you would have already gotten from others. Where is the link to send it back..

  62. Fried says:

    I find that really nice ! for instance to display the definition of a word in a text.

  63. The demo shoves the content of this page to the left with no way to get it back (FF3/Mac).

  64. Leandro says:

    Hi, the effect don’t work in IE6. Do you will fix it?

  65. Nice! I think it’s good for site’s context-help. There isn’t visible horizontal page slider, which is also a plus. Thanks.

  66. webbo says:

    Thanks for this, I really like this effect and have a upcoming project that it will be perfect for.

  67. ceej says:

    I’m loving it, but is there anyway to use a hidden in page div rather than using ajax?

    Thanks again!

  68. GreyK50 says:

    Wow… gonna use this in my new coming project!!! Thanks for sharing this… thanks.

  69. JK says:

    Hey Scott,
    This is exactly what I’ve been looking for. However, is there a way to put a link inside the slide which closes it? I’ve found users are getting confused by having to click in the body of the original page to return.

    Thanks,
    JK

  70. Brian says:

    Love Your pageSlide idea. One question… any idea why it seems to call (document).ready twice?

    Does the wrapAll do this? Any idea how to get around that?

  71. zoel says:

    cute! and sexy! …for portfolio site ;-) and how to make the slide is out from top or bottom page?

  72. Nicolas says:

    Hi,

    PageSlide seems to be very interesting. The effect is nice, ergonomy is okay. But it seems to have some troubles in IE6.
    I’ll keep an eye on the project, thx.

    Nicolas

  73. Abadeu says:

    Love the concept, I have been looking for something similar for a while. This plugin is incouranging me to learn a language that was not all so foriegn, but onw I knew took time to learn. With this plugin- as well as other, I will dive into jQuery.

    Enjoy

  74. Kaiserlino says:

    Demo is not working :( O

  75. Kadir GÜNAY says:

    that’ s so interesting :)

  76. Leo Machado says:

    Forms does’nt work with page-slide, i guess thats because this line:
    $(“#pageslide-slide-wrap”).click(function(){ return false; });

    can you help me?
    nice work! ty

  77. nice tutorial. thanks.

  78. savage says:

    any way to get this working with IE 6 ??

  79. Very nice jquery demo. I see the code to trigger the pageslide. How do I trigger it to close? I realize a click on the main content will close it again, but that’s not an obvious “close” behavior. Very nice work though.

  80. Jt says:

    Great entry! I will definitely be using this in a project!

  81. Sean says:

    Great concept! It would be nice to have a “close” or “slide back” button in the example.

    One issue I do see, is the fact that the original content is hidden behind the left border when the new content is out. Do you think it would be better rather than to slide the initial content left, to slide the right border of the initial content left, allowing content to re-appropriate space for itself? Leverage the benefits of HTML documents as well.

    Nice work!

  82. Nicolas says:

    This effect seems not well working in IE6.
    The block injected by ajax appears in the bottom of the page.

    Too bad, the effect is nice.

    Nicolas

  83. Scott Robbin says:

    Hi All,

    Oy, I have to apologize: I just realized that Wordpress was moderating all comments to this blog (it’s a new install), so none of these had been approved until today. I’m sorry, it wasn’t my intention to moderate the comments with this heavy of a hand. ;)

    I’m in the process of moving this site to a faster server, then will return to answer your questions. Thanks so much for the great feedback and words of advice.

    -Scott

  84. matthew says:

    The problem I am having is that other ajaxed content is being pulled into the slider area when any link is clicked. Any way to tell it to just pull in content from just a certain href?

  85. spine says:

    in regards to comment #79

    I changed return false to true and everything now works perfect. In a quick test I couldn’t find an usability issue (text can still be highlighted etc.), please comment if you think otherwise.

    # 49 – old:
    $(”#pageslide-slide-wrap”).click(function(){ return false; });

    # 49 – new:
    $(”#pageslide-slide-wrap”).click(function(){ return true; });

    If you want some kind of “close” link change:

    # 75 – old:
    $(“#pageslide-content”).html(data)
    .queue( function() {
    settings.loaded();
    $(this).dequeue();
    });

  86. spine says:

    oops pressed enter… now again :D

    If you want some kind of “close” link change:

    # 75 – old:
    $(”#pageslide-content”).html(data)
    .queue( function() {
    settings.loaded();
    $(this).dequeue();
    });

    to #75 – new:

    $(“#pageslide-content”).html(data)
    .queue( function() {
    settings.loaded();
    $(this).dequeue();
    }).prepend(“schließen“);

    —-

    If you changed the code to that from my previous comment that’s all you need. :)

  87. spine says:

    not my day -.-

    “schließen” means “close” in German – change this string to your needs…

  88. Kirill says:

    This is so awesome! I would love to start using it straight away. Unfortunately it is not compatible with IE6 :( Will have to wait ;(

    Great plugin though, will be waiting for updates.

  89. kst says:

    How can i fix script work on IE6?

  90. Celia says:

    Hi, is there any updates for IE6 Compatibility Issue?

  91. Eder says:

    Hi, in secondary page there is a form but isn’t working the PostBack event. Is there a way to fiz this?

  92. HotCouponz says:

    Great plugin, but without IE6 support, we can’t use it.

  93. acmomus says:

    I love the plugin, Thank you so much.

    I want to create sliders which trigger by clicking on a specific text of lists within a accordion.

    For example, like in the iphone how contact app slides horizontally and click top left button to go back to the previous menu, except within an accordion menu.

    Could you please, please help me?

  94. Rob Record says:

    I agree with Chocksy, comment #58. Pane should slide over, not push.

    Nice though.

    I implemented something similar recently on one of my client’s websites.

  95. Rob Record says:

    Just so you know.. we don’t say poppycock in the UK. :)

  96. Alexwebmaster says:

    Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

  97. DigitalCoder says:

    It does not work on IE6

    Damned :(

  98. Çağrı says:

    thanx..its great bur i’hve some trouble…

    i want to use it to show full page…so,i want that when thw link is clicked,page slides and show widt %100 of other page…

    i change in js codes up,changed width but it wasnt how i wanted..

    and the second is whem its clicked second page’s bg img isnt shown…only bg color code is working…

    how can i fix these?

  99. Leo Machado says:

    My portfolio using pageSlide

    http://www.axblue.com

    :D

  100. honour chick says:

    very useful plug in… thanks! ;)

  101. DominixZ says:

    Awesome Plugin , I will use it next time for my app.

  102. Great thing for me to use on the About me link. Thnx!=)