From our sponsor: Ready to show your plugin skills? Enter the Penpot Plugins Contest (Nov 15-Dec 15) to win cash prizes!
This experimental jQuery plugin allows the automatic grouping of thumbnails using a pile effect. The thumbnails will group according to their shared data-pile attribute and once clicked, the pile will disperse and its thumbnails fly to their positions. The thumbnails can be slightly rotated or positioned with a delay.
The grid itself is adaptive, meaning that if there is not enough horizontal space considering the width and the gutter of the items, the column count will decrease and the grid will re-order.
The demo features some Dribbble shots of the following artists:
- Bryan Moats
- Mike Dornseif
- Griffin Moore
- Andrea Austoni
- Jakob Pierzyna
- Jack Hughes
- Jeremy Fryc
- Joyce Rice
Please note that the CSS transforms and transitions only work in browsers that support them.
There is a simple jQuery animate fallback for browsers that don’t support transitions.
For using the plugin, an unordered list with the class “tp-grid” is expected, i.e. in our demo we use:
<ul id="tp-grid" class="tp-grid"> <li data-pile="Group 1"> <a href="#"> <span class="tp-info"> <span>Some title</span> </span> <img src="images/1.jpg" /> </a> </li> <li data-pile="Group 2"> <!-- ... --> </li> <li data-pile="Group 1,Group 2"> <!-- ... --> </li> <!-- ... --> </ul>
The data-pile attribute will contain the name of the group that the item belongs to. Note that an item can belong to more than one group.
The plugin can be called like this:
$( '#tp-grid' ).stapel();
Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Subscribe and get our Collective newsletter twice a tweek.
Options
The following default options are available:
$.Stapel.defaults = { // space between the items gutter : 40, // the rotations degree for the 2nd and 3rd item // (to give a more realistic pile effect) pileAngles : 2, // animation settings for the items of the clicked pile pileAnimation : { openSpeed : 400, openEasing : 'ease-in-out', closeSpeed : 400, closeEasing : 'ease-in-out' }, // animation settings for the other piles otherPileAnimation : { openSpeed : 400, openEasing : 'ease-in-out', closeSpeed : 350, closeEasing : 'ease-in-out' }, // delay for each item of the pile delay : 0, // random rotation for single items randomAngle : false, // callback functions onLoad : function() { return false; }, onBeforeOpen : function( pileName ) { return false; }, onAfterOpen : function( pileName, totalItems ) { return false; }, onBeforeClose : function( pileName ) { return false; }, onAfterClose : function( pileName, totalItems ) { return false; } };
The basic styling is defined in the stapel.css file and you can see an example of some additional styling for the demos in custom.css.
Demos
Check out the demos to see some different configurations in action:
Amazing!!! very useful pedro
Awesome….I will surely use this in my next project
Magnifique!
Great work, Thanks for awesome tutorial
Amazing…
Magnificent! Awesome!!
Another amazing Effects..Thanks !
amazing effect !!
Thanks , it’s very nice!
Everything you create i want to use. Simply stunning!
Def going to be using this soon! Much thanks!
Wow ! Wonderful effect, and works on IE7 !
It’s amazing!!!! I have a question:
You can enlarge the image instead of using a link? To make it as an image gallery.
Thank you!!!
I’am afraid you can’t do that with this script. But I’m sure you can integrate a lightbox script here…
Hi Emily! Yes, I was able to add a lightbox to images to enlarge them. 🙂 This is a fabulous script!
Thank you all for your feedback! I’m glad you liked it.
Hi Pedro,
Can you give an example of integrating a prettyPhoto jquery plugin over this?
Thanks
Hi Brian,
I didn’t use prettyPhoto, but another lightbox plugin. You can view the example I made here: http://pilatesnharmony.com/gallery.php
was great, thank you very much.
Amazing boy just amazing!
Thanks 🙂
I dont know how can I thank you guys… I love codrops updates, because you guys, you always show somethings that we can learn.
Thank you very much! THX! 🙂
Thank You for Sharing, always a good tutorial and idea from codrops team!! nice effect!! Great Job!! thx again
Wow!! Great Job man.. 🙂
Wow that’s great 🙂
Magnificent and Super Awesome. Definitely usable! Thanks for the tutorial Pedro.
This is simply great!
thanks pedro ,Super Awesome …:D
You are just awasome!!!!
Very Interesting effects. Thanks for the plugin. It’s Awesome.
Slick and stylish. Love it. I’ve yet to look at the source, so what browsers will it NOT work under?
ck….ck….ck….^^
????? ???????????! Bravo!
Do you have any idea HOW YOU ARE CHANGING THE WAY WE SEE THE IMAGES IN WEB PAGES TODAY?; You are doing an amazing job.
Thanks for sharing this and make the Internet a more friendly place for everyone of us who love this…
Thanks again…
Love this.
Is there anyway you can look at adding a reupdate function? This would be perfect if I want to call the photos on ajax.
E.g. Click the “stack” and then it will call the request, once that’s complete it will append the images and then I just need to call reupdate to get it to realise theres new images?
Thanks
This is brilliant. Thank you!
Love the tutorial! looks amazing!
Did I ever mention how much I love your team! This is exactly what I wanted to make and you taught me how. Thank you!
Awesome tutorial !! Like every time !!
There is just a little bug. When you delete the border of the image, then you open one stack and then close it, there is a problem on the image loading. All of them are not loaded. Any idea to fix this bug ?
I’ve started to write integration with Drupal Views. http://drupal.org/project/views_stapel
I’ll be very happy if it would be helpful to someone.
Is it possible to add a jQuery Lightbox effect to this?
Did you ever get an answer to this Anthony or figure it out. I’m finding the JS conflicts when I try to add a lightbox effect. Can’t seem to find a solution.
Sharon and Anthony,
I’m not sure if either of you got an answer to this or not, but here is an example of this script with a lightbox effect in place.
Hit me up with any questions: contact [at] savionsmith . com
… Forgot the attachment link … DOIH! lol. http://pilatesnharmony.com/gallery.php
Gud ………
Love it, thanks! I’m looking for the function that will open one of the stacks on page load – anyone got suggestions?
I found a strange occurrence in Chrome. If I enqueue jQuery from WordPress 1.7.3 it doesn’t show the stack. If I use jQuery 1.8.3, it does. In Firefox it works with the latest WordPress jQuery build. Firefox works well on all counts. But Safari and Chrome don’t behave right when using the enqueue jQuery in WordPress.
Any ideas why that would be the case?
Thanks!
Justin
Hi Justin,
same problem here. Can’t figure out what should be the problem.
Did you find a solution?
jQuery 1.8 introduced the “Automatic CSS prefixing” which is not part of the current jQuery version used in WordPress (1.7.X). In order to work we need to add the appropriate prefixes in the script. I’ve added a slightly modified version of the script here:
http://tympanus.net/Development/Stapel/js/jquery.stapel.older.js
It’s not fully tested but it seems to do the job. Let me know if it works fine for you. Cheers.
Thank you Pedro,
I offer myself as tester. I’m gonna use your plugin in our next WP Theme and I’ll let you know if I’ll experience any kind of issues.
Thank you again.
FIXED:
If you comment the following code:
if( !this.support ) {
$item.css( this.transformName, ‘none’ );
}
the script works fine also on IE.
I was upgrading my website and was looking for some new way of showing my Design Portfolio . I have found the perfect script for it. Thanks Pedro. 🙂
I have a problem, internet explorer hides displays images. please help me. http://bit.ly/Rt6lD7
resolved, the image must be the same size.
Hi Will,
Can you let me know how did you integrate PrettyPhoto over Stapel? I am using JQuery… 1.8.3. It does not seem to enlarge the thumbnail 🙁
Thanks
Any response on how you got this to work with prettyphoto ?
Thanks!
Will, your site is amazing by the way 🙂 Very beautiful.
Best effect.
Please info me what make top z-index hover effect?
http://www.proxin.net/_stapel/
Thank you
Does this widget support multiple level of nesting? Or just one?
woww it’s very nice 🙂
Hi folks,
I’m playing with this beautiful effect and I found that when the page is too big, the stack opens and the browser stays where it was, so the open stack can get out of sight. I just added at the bottom of _openPile an animation to scroll to the top of the page (can be the stack container) like this:
/* scroll to top */ var top = self.el.offset().top; $("html, body").animate({ scrollTop: top }, 100); // You can use 0 to scroll to the top of the page, you get the idea.
Hope somebody finds it useful.
Good morning!
dude, can you tell me where do I stick this code? because really when you surf and back to home, and selects the next block, it does not start at the top!
I added just
$("html, body").animate({scrollTop: $("#close").offset().top}, 400);
right afteronBeforeOpen : function( pileName ) {
in function calling at the bottom of the body and it works fine.Hi can you please tell me how to hide Grouping Functionality from above demo… actually i want to display list of photo with pile effect only.
Thanks
Hi,
This is a beautiful effect. Does anyone know if it would be possible to add isotope/masonry to improve the layout?
Nice effect, I ‘d like to ask you something…
In the piles if you remove the background of the title, on IPAD appears all the rest of the titles… is there something to hide the rest of titles and just show the most-top title of the pile.
Thanks again.
This is pretty nice. Seems simple enough to use….but for some reason I can’t get it to work on localhost. It just does the loading boxes but that’s it. I’ve verified that all the necessary scripts, css and images are in place.
I can get it working on a live server, no problem. Is there a trick to get it working on a localhost or am I just missing something? Any info appreciated.
Thanks
good one sir