Just what the world needs, another jQuery slider. YAWN. I know, check this one out though, it's got lots of cool features.
Here on CSS-Tricks, I've created a number of different sliders. Three, in fact. A "featured content" slider, a "start/stop slider", and "moving boxes". Each of them had some cool interesting feature that I needed to build at the time. All were well-received, but as is the case with these things, people want them to do X, Y, and Z in addition to what they already did.
This new AnythingSlider is an attempt at bringing together the functionality of all of those previous sliders and adding new features. In other words, to create a really "full featured" slider that could be widely useful. This is the first time (on CSS-Tricks) that one of these sliders is an actual plugin as well, which should make implementing it and customizing it much easier.

The demo page has the current version, complete usage, and up-to-date changelog.
Features
- Slides are HTML Content (can be anything)
- Next Slide / Previous Slide Arrows
- Navigation tabs are built and added dynamically (any number of slides)
- Optional custom function for formatting navigation text
- Auto-playing (optional feature, can start playing or stopped)
- Each slide has a hashtag (can link directly to specific slides)
- Infinite/Continuous sliding (always slides in the direction you are going, even at "last" slide)
- Multiple sliders allowable per-page (hashtags only work on first)
- Pauses autoPlay on hover (option)
- Link to specific slides from static text links
- ....and.... ...wait for it.... more!
Customization
Adding/Removing Slides
Just add or remove more <li> items from the list inside <div class="wrapper">, everything else happens automatically.
Adjusting Size
For example, if you wanted to make the slides 580px wide instead of 680px wide, you just need to change some CSS. Change the width of .anythingSlider ul li to 580px, change the width of .anythingSlider .wrapper to 580px, and reduce the width of .anythingSlider 100px to 660px.
Linking Directly To Slides from Static Links
Target the link using and ID or Class (or whatever), and apply a click handler. Then call the plugin function and pass it a number of the slide you are trying to link to:
$("#slide-jump").click(function(e){
$('.anythingSlider').anythingSlider(6);
e.preventDefault();
});
Credits
It was written by me, with code piecemealed together from some of Remy Sharp's sliders and my own previous sliders. Doug Neiner stepped in and helped make it more efficient, smart, and fix some bugs.
Great job on the slider. It might be surprising but its not that easy to find a slider on that incorporates html into the slide. May I make one little suggestion, how about when it reaches slide 6 it reverses direction and slides back to the first one instead of progressing the in the same direction back to slide one.
Great job, Chris.
I think I’ll try this out tonight.
Well done Chris – looks pretty fancy. The navigation could indeed be a bit changed/better, but that’s for future use.
Oh, why is “easeOutBack” the default easing? I know it looks the best, but the user needs an additional plugin.
Keep up the great work!
Yeah good point, should probably have a default of “swing” or whatever. It does come bundled with the plugin and clearly states it needs it though. I just really like the “easeOutBack”, looks so much nicer.
Nice one Chris, can this be used in website templates if proper credit is given in the download file after purchase?
Sure, go for it, I don’t mind.
The validator doesn’t like those
tags in the image titles, is there not a cleaner way to do it?That went well.
I was talking about the break tags.
Sure just remove them. They have nothing to do with the slider really, just the design I was using for some of the slides.
Oh, and plus, fuck validation.
(Network specialists and security experts pass out)
lol
Said very well :)
LOL. You tell um Chris
I’m not sure weather your being serious or not?? :-)
I agree, I just made this post a second ago but you should see this guys work. http://ennuidesign.com/demo/contentslider/ he has it sliding with a DIV so you can slide anything; I wish he had it with counting the DIVs like this example counts the LI but ennuidesign works really well. Hope to be of help :)
I dig!
thanks for posting
Thanks for yet another neat slider Chris. Can’t wait to sink my teeth into this one.
I love it, just what I was looking for!
Wow!
Love the slider, especially the smooth and endless transitions.
Great work!
You might like this too, http://ennuidesign.com/demo/contentslider/
This guy has ANYTHING sliding not just LI but DIV.
Jason’s slider is pretty cool. Just for the record though, using DIV vs. LI is pretty irrelevant. Either slider could easily be adjusted to use either type of HTML element. They are both block level elements…. List items are used here because a bunch of slides is kind of like a list, and the UL wrapper is kind of useful in the CSS.
Yes, agreed.
Very nice!!!
Your posts always seem to come at just the right time! Right when I’m searching for the exact thing for my portfolio page… I’ll download and look into the files… hopefully there’s a simple way to change the page navigation. Other than that it looks beautiful!
Thank you so much Chris.
Or in my case, just a day late on this one! Only yesterday I implemented another slider. As an earlier poster mentioned, one that does not have HTML content (it used images only).
And now I find this… which has ALMOST everything I want! A day late!
Only thing missing is a third auto-rotation option: rotate through all slides once, and then return to the first slide.
But I’m starting to learn me some jQuery. Maybe I can try my hand at implementing that feature. ;-)
You can add some like this for the pause on over you are wanting to add.
base.$el.hover(
function () {
base.startStop(!base.playing);
e.preventDefault();
},
function () {
base.startStop(!base.playing);
e.preventDefault(); }
);
Thanks Adam! We are gonna build this into the next point release for sure.
Nice, one (i told this via twitter) I just need a little suggestion, can you please not hard code the ‘start’ ‘stop’ labels of the button?
For the record, this is fixed in v1.1
Love it! Thanks for all the great examples. I was looking for a “Do it all” slider.
Lovely stuff Chris.. I specially like those navigation arrow effect.. never seen them before :)
P.S. Tweeeted!
This is amazing, exactly what I need for my new web-site. My client will be very excited about this.
I really like this. You mentioned that for a future release you could: “Build-your-own navigation, so you could for example, use inline images that are clickable to go to particular slides.” Would it be possible to extend this a bit by having the hashtags load that particular slide. So, for instance if you were to link someone to http://css-tricks.com/examples/AnythingSlider/#panel-3 externally, it will open the page with that slide active?
I have seen this done in other sliders, and since this is the “everything slider” that would be a nice feature also.
Thanks Again!!
Rich
That’s already a feature Rich =)
yeah sorry, you were quicker to reply than I was.
or wait. is that already happening. Nevermind I think it is.
Incredible job Chris! thnx for sharing.
Is it just me, or is Environmental Engineering spelled wrong in the last slide?
Otherwise, good job!
Any way to make customize the navigation button titles?
i.e. Rather than “1, 2, 3, etc” could you use textual names that make more sense?
Since you can load in html as slides, it might be handy to use page names instead of sequential numbering.
in the jquery.anythingslider.js
make these changes:
you will also need to modify the slider.css #thumbNav section:
(here is mine)
Great!, can’t wait to try it out!
slide titles don’tshow up in IE7
Al
This post was right on time. I was searching for a good slider for a big project. You’ve saved me a ton of work. Thanks Chris.
wonderfull
It took me a while to take notice that there is real text sliding around. Love it! Are Easing and Titleblock in the js-folder necessary for the slider itself?
No they are not, the latest version, which you should snag, omit them.
Awesome Chris!! The linking from static links was HUGE for me. As always, amazing work!!
This is very good !
Just 1 query…
What if I have say 50 photos, and I want to display them using your slider. Is there a way to get pagination for say set of photos. Like is it possible to have 10 photos per page, so it would be like..
1.. 2.. 3. … 10 … Page 1
1.. 2.. 3. … 10 … Page 2
and so on.
Pawan
You should be able to do this with ajax or maybe PHP.
Use PHP to “build” the LI list dynamicly thus making it paginate.
Sorry for the spelling :) im a poor swedish :)
Good luck to you!
Any hint on how to achieve the same using ASP .NET?
Thanks,
Pawan
Great job, Chris! Thanks for sharing this beauty.
Nice work Chris, It’s always nice to see your JQuery work. I’ve bookmarked this along with many other pieces of your work.
Can you integrate flash into any of your sliders?
Also, got my votes in for you on the .net awards. best of luck with that!
why don’t you transform this Slide for joomla?
Very very very nice!…
Any chance there will be proper IE6 support in the future? :)
Should work fine in IE 6…. ? The PNGS probably look like shit, but you could just replace those graphics with non alpha-transparent graphics, or… use a PNG hack.
Whats really proper about IE anyways :)
It´s a browser that gets on my developer nerves :)
Hey Chris,
Great post, great blog, hit your site everyday from all the way over here in Cardiff, Wales, UK!
Just a question…
What content slider plugin do you recommend for use with WordPress? The Featured Content Slider thing is all over the place now, any others you recommend?
The slider in this post is great but would you use it in WordPress?
Thanks, Matt
Sure. Why not?
WordPress doesn’t care what slider you use.
Thanks. What I meant is could it be used to display posts in wordpress like a feature content gallery?
Thank you for this awesome slider. I too am trying to implement this on a wordpress site.
I have pasted the script embeds and code into my header.php file in the head section. I have also uploaded the js, images and css files included in your download into my theme directory.
Now it seems though that the default links to the css, js and images are not working for me. When I paste the contents of the div “anythingSlider” into my wordpress page to test functionality, it is just displaying an unstyled list with no images, css or js slider presentation.
Do I need to alter the path to the css and js in some way specifically for wordpress? I’ve tried inserting an initial forward slash before the css and js directories like this
script type="text/javascript" src="/js/jquery.easing.1.2.js"and it didn’t seem to help.Any ideas out there? Thanks!
I would say thats only limited by your imagination :) You should be able to do that with some thinkering and smart coding.
Good luck :)
Definitely doable in WordPress. I’ve put a bit of thought (not much yet) into this, and there would be a few things you’d need to change to make it seamless.
But for example, you could create a separate PHP function that would “build” your slide based on the contents of your post, or if you’d rather have control over every single aspect of the slide so that they look dynamic instead of similar from one slide to the next, you could have it such that slide content is taken from a meta field instead of using the post content/title/etc.
To do it automatically, have a look at the free Androida theme and they way they populate content into their own glider. (note: at my blog at monkey-house.ca, I describe how you’ll need to work with the limit post plug-in properly, because by default it uses PHP’s striptags() to completely sanitize content, which you probably don’t want).
I don’t know how to write a plug-in yet, but it seems like a great slider to use as a base for a featured content slider plug-in. If I dig into it, maybe Chris will even let it be published as a plug-in. ;-)
Greg
I’m using this slider in WordPress at http://herrindesign.com. (It’s a projects slider a little ways down the page.)
hi chris
great tut
how to randomize the slides ?
like it may jump from slide one to last slide and so on ?
thnx for this tut
Great… this is another one i will add to my list. Thanks Chris. :D
This is a nice slider – I especially like the styling for the next/previous arrows. Great use of PNGs :)
sweet! I was just looking for this exact thing. thanks for saving me some time!
Great work guys, this is awesome!
that’s amazing and working fine. thanks
The downside of having a high profile – everything you do undergoes massive amounts of scrutiny! Still, you could consider it free beta-testing…
It looks very good, and I like the fact that it appears as a scrollable window when Javascript isn’t present.
Haven’t tested in IE6 yet – those transparent PNGs can be easily fixed though.
If CSS if turned off but JS is still running there is a duplication of some content – might be a semantic or accessibility issue (sorry, really nitpicking here)?
Great work, good luck with the .Net awards!
I think CSS-Off, JavaScript-On is one of the rarest browser circumstances. Too few hours in the day to be diddling around with that, in my opinion.
I was thinking of the ‘user’ mode in Opera, but yes, I appreciate your point.
really fantastic.
I was unclear as to whether you can click on a slide to link to another page. It does do this right?
Assuming so, I wonder if your demo could show that. Since that’s part of why I was unsure.
Most grateful for your excellent work! Have voted for you on all!!
excited to try it out, really excellent work as usual!
Thx!
Nice lil plugin, Chris! This will come in handy, and certainly save time, should I need it. Thanks!
You never stop amazing me. Though calling this a “plugin” made me instantly think it was made FOR wordpress and not as a tool for every site.
Not a huge issue as it is still what I am looking for confusion or not.
I like how you made it so the last slide goes right to the first unlike the other sliders i.e. they cycle through all the other images before it arrives at the first image.
Well done, what else can I say? “well done”
This works great Chris, usual good work! Would you consider turning this into a WP plugin? I’d love to see a screencast on the steps you would take to update the slider content using WP posts.
This is great. I have something very similar to this on the homepage for my site – I should totally make a YUI3 plugin version of this. :)
Nice work Chris! Super clean, and has a couple features I have recently been looking for in sliders. I used a couple sliders on this page of my site, but I think I might try out your version. I like how it loops around again.
What if you wanted to have three images in a row horizontally visable at a time instead of one, and when you click right it moves to the next one (so two of the originals are still showing). Is that possible?
I’m curious about this too.
I couldn’t see and obvious way in the .js file to enable this ..
Search Moving Boxes example by Chris on this same site.
It should do exactly what you are thinking.
Is it?
The moving boxes example here: http://css-tricks.com/moving-boxes
Is not built for infinite scrolling.
Great slider and plugin. As usal i get alot of good information from your site and posts.
Have learned alot off CSS and Design related things i had not yet heard of before.
Keep up the good work!!!
Looks amazingly good, was hoping there would be an option for vertical sliding rather than just horizontal. Is this easy to do because this is probably the nicest slider i have seen so far.
“Easy” would all depend on your skill level. It would certainly be a whole day of work for me (looking at the code) but probably 5 mins for Chris. ;-) 5 mins to just change it, that is… more time than that to make it an additional option.
But if you just wanted to change it wholesale, it would be a matter of digging through the logic for how the “monolithic” slide is created, then make it vertical instead of horizontal. Then when the scrollLeft() function would be called in the default plug-in as Chris has made it, the statement would ultimately become
"base.$wrapper.scrollUp(base.singleHeight * page);"Naturally, that’s only the end result, not the work that would go into it. I didn’t dig into the code enough to know if you need to create logic for singleHeight or not, and frankly I don’t even know if scrollUp is a function.
That’s why it would take me at least a day… I’m just not fluent enough in the language to be able to rip out a modified version. I’d have to do a lot of trial and error. ;-)
All that to say; I’m confident that it can be done, and “easy” is a matter of your skill and experience.
Well done!
Looks very useful and nice :) Will definitely help getting a good slider instead of searching endlessly for one that barely works.
Hi Chris & Everyone
Thanks for sharing this beauty.
I think look very nice and useful for us. It is great slider and plugin. Last week I find this type of plugin. So it is very very useful for me.
AGAIN THANKS
Fantastic slider I am going to use in my next project I’ll be sure to post it here for all to see.
QUESTIONS: How do I change which slide is linked to from the static anchor link in the body below the slider? I am wanting to create a webside with this method so would like to have some tabs insead of the numbers.
Thanks again I love you site and you videos and tutorials have enabled me to quit my day job and start my own web design company, so thanks for that.
Wonderful! Elegant.
Are there any plans to include a CAPTION function?
BTW- love your entire site.
Great work here.
Quick question, if you are on a different page can you still link to a specific slide? (i.e im on the home page and click learn more, and get brought to slide 6 on the about page)
I appreciate any insight
just answered my own question. yes you can link to specific slides from other pages.
This script rocks – thanks a lot man
Hey Chris, this is perfect, thanks! Building it into our website today!
OK I’m tearing my hair out here… I keep getting this JS error:
base.$wrapper.scrollLeft is not a function
This seems to be the only thing that’s stopping it from working. I can scroll right no worries, but the left arrow never exits the hover state. Any ideas anyone?
PS – It’s getting stuck in an infinite loop, scrollLeft keeps getting called…???
I am messing around with this. It is pretty cool. Can you show me an example of formatting the tab navigation to showing text/titles or images that correspond with the slides. Such as a title to go with each slide. Or a thumbnail image that goes with each slide.
This is pretty cool and very handy.
Thanks, and keep the knowledge flowing. Web development and design. One of the only communities that has an open mind to share with the world. Great stuff to better the web.
Very Good, show the ball, it is very useful to me!
Congratulations!!!
I put my photo in the comments …
How do I do?
what?
I think you probably mean:
http://gravatar.com
yes.. GRAVATAR .. that most of us use.
Just …. little more on the topic..
Avatar is a “Hindi” word. Hindi is the language used in India.
Avatar in Hindi means, a divine manifestation incarnating directly from God.
GRAVATAR is just .. Globally Recognised Avatar.
This is so great! I am ready to use it, but…
I want to display images and text on the slides. I want to let the user see the picture and read the words and be able to Click on the words or pic to go to a page on that specific topic.
How do I do that?
Thanks for you help!
Hi Chris, not too sure whether we’re able to hardcode descriptive text into the yellow tabs along the bottom as opposed to the numbers?
And if so how would a noob like me go about doing that.
Love your site and your work by the way.
This looks interesting. I’ll test your slider tonight. Does it preload bigger images?
OK I figured out what was going wrong.. this doesn’t work with jQuery 1.2.4 which I still had…
Use the latest build everyone!
Has anyone tried to use this slider in Blogger? I have implemented the code in a demo site, and everything works great, except the pictures are pushed to the right by 40 pixels. Anyone have any idea why it is doing this? I can adjust the CSS to fix this, but the demo site here lines everything up perfectly using the same CSS. Does this just not work right with Blogger?
Oops, sorry. Demo site is here, my original link did not work. In case this doesn’t work it is pspdemosite.blogspot.com