My favorites | Sign in
Project Logo
                
Search
for
Updated May 18, 2007 by bruno.bornsztein
Labels: Featured
Glider  

Glider.js

This script makes it easy to create a sliding carousel component like the one seen at www.curbly.com. Inspired by www.panic.com/coda.

Download

The latest files are available for checkout via SVN here.

You can also download a zipped version here.

Example

View an example of this component in action.


Comment by insign, Jul 16, 2007

Good script, make it update always!

Comment by janaalt, Jul 26, 2007

Can you use an image map for the navigation links? I tried and it doesn't work as is. I assume changes to the js are required to do this?

Comment by janaalt, Jul 26, 2007

Can you use an image map for the navigation links? I tried and it doesn't work as is. I assume changes to the js are required to do this?

Comment by iHunte, Jul 31, 2007

Great Script! Thanks a lot!

Comment by anthony.abraira, Aug 28, 2007

Is it possible to access one of the div's directly. Thus if a user goes to another page you can go back with something like this:

http://domain.com/gliderpage.html#section1

Comment by anthony.abraira, Aug 28, 2007

Is it possible to access one of the div's directly. Thus if a user goes to another page you can go back with something like this:

http://domain.com/gliderpage.html#section1

Comment by ndoherty13, Sep 16, 2007

Nice job.

I recently created a Coda-style slider using jQuery. If anyone is interested, it’s at http://www.ndoherty.com/demos/coda-slider

Comment by mcposeidon, Sep 22, 2007

Nice one,tnx!

Comment by m...@ondesignstudios.com, Oct 11, 2007

Great script, needs a pause feature for the auto glide and it would work perfect for a lot of peoples needs I think.

Comment by ja...@greenvoice.com, Oct 16, 2007

Hi, Glider.js seems to be broken at the moment? The example page is not working?

Jason

Comment by cgutierrezv, Oct 17, 2007

Realmente bueno, felicitacione y gracias por compartirlo. El autoGlide me funcionó a la perfección.

Saludos.

Comment by phparray, Nov 01, 2007

This works almost perfectly with something I'm currently working on. I have one problem. I want to use it in conjunction with lightbox. Both apps us the prototype framework and they conflict. Here is my modified example page: http://www.xclusivesites.com/SmoothGallery/glider/example.html I can get the glide action or the lightbox action to work but not both. Any suggestion?

Comment by jared5burns, Nov 01, 2007

See it in action...

http://www.fetchapp.com/tour

Comment by bokinga, Nov 03, 2007

best solution I've ever seen. Nice&Clean, working without javascript enabled, w3c standard… All you need. In one word: "Great!"

Comment by fatfingur, Nov 12, 2007

How do you put an active state class on the buttons?

Comment by arie.mail, Nov 17, 2007

I'd like to know the same thing as fatfingur, how to set an active class on the active section.

Comment by rain.kes, Nov 20, 2007

is it possible to put moving 2 windows with one button? if I have buttons, div-1 and div-2. When I press one button then both div-1 and div-2 scroll... is it somehow possible?

Comment by thad.mac, Nov 27, 2007

Is there a way to change the orientation of the control to vertical instead of horizontal?

Comment by SamRicheson, Jan 19, 2008

i stumbleed upon this. http://design-police.org/ Very cool effect. Not to sure how to use the content. Any ideas?

Comment by andreadimambro, Jan 22, 2008

I have used it centered in the page... http://www.carrozzeriafecchi.com

Comment by jcalv...@eastbaynewspapers.com, Jan 24, 2008

I love this script! I've been playing with it and make some modifications and it's working great. I have question/problem how do script the active link like http://www.fetchapp.com/tour ? I have 5 sections that cycle through, the slider section has 5 "indictor" circles like iTunes, when you mouseover they get turn grey. I want to have the circles be black when the corresponding section is show (ie. section 3 visible, 3rd circle black). How can I do this?

Comment by vporciuncula, Jan 30, 2008

The Coda Slider is, I guess what we're all looking for, but the way it scrolls isn't as smooth as the glider. This glider.js is perfect, but we need instructions on how we can configure it to look like that of Coda's. Hope the solution can be posted soon. Something like www.dynamicdrive.com/dynamicindex17/featuredcontentglider_dev.htm would be sweet. the only problem with this script is that it scrolls vertically.

Comment by gaker1, Jan 31, 2008

I like how the "Design Police" just stole straight from the panic/coda website, and stripped out the copyright & "not for redistribution" comments from the JS.

Comment by gaker1, Jan 31, 2008

Bruno,

I don't really know much at all about javascript, let alone Prototype/Scriptaculous. With this, I don't have to worry about it. All of my head banging was dealing with css, but now I have it! Thank you so much!

Also, thanks to jared5burns for posting the example using mouseover/active images, as picking your code apart was a big help!

-greg

Comment by n1tn4t, Feb 05, 2008

glider.js version 0.0.4 doesn't work with ie. there seems to be a bug in slide animation.

Comment by n1tn4t, Feb 05, 2008

i've found the mistake. when replacing

moveTo = this.wrapper.down('#'+element.href.split("#")[1])
    this.moveTo(moveTo, this.scroller, { duration:this.options.duration });     
    Event.stop(event);

with the code from v.0.0.3:

this.moveTo(element.href.split("#")[1], this.scroller, { duration:this.options.duration });     
    Event.stop(event);

the bug is fixed and the animation works in ie, too!

Comment by kcarunida, Feb 14, 2008

This fix still doesn't seem to be working for me in ie6. Anyone else having issues with this?

Comment by foamcow, Feb 26, 2008

Can you tell me how to create a link control link outsider the glider div?

I'm trying to do so using the moveTo method, but I can't seem to work out what parameters to pass to the method.

I'm creating a link like so:

<a href="#dm" onclick="portfolio_display.moveTo('dm','portfolio_display',0.5);return false;">Direct Mail</a>

Comment by tho...@gamingeye.com, Mar 27, 2008

thad.mac, Sure, you can do it by these actions: Remove the "float: left" line from the CSS-part Reduce the width of div.scroller div.content (in case you have a div width a fixed width in the content, just add one if you don't)

kcarunida, 0.0.4 works in both IE6 and IE7, have you updated the scriptaculous libraries?

foamcow It's a bit tricky but here's the code you need: <a href="javascript:void(0);" onclick="portfolio_display.moveTo('dm', $('my-glider').down('div.scroller'), {duration: 0.5});">Direct Mail</a> You might have to change "my-glider" to what you have replaced the div id with in your page.

And... A thank you to the developers of this plugin, it's great!

Comment by h...@inneractive.nl, Apr 01, 2008

Could anyone help me to make this work? See glider example, http://www.inneractive.nl/example.zip. I just need the tabs to be selected when current section is shown, if possible also switch tabs when you use the “next” / “previous”. I’m not really a js master so the work i did, didn’t work :(

Thanx a lot!!

Comment by madd...@yahoo.com, Apr 07, 2008

Hi, Is there a way to make this glider go by pixel width instead of section id? In other words, can I make it go 500px to the left or right at a time? Sorry if this is a trivial question. I'm a JS noob :)

- V

Comment by ejosephat, Apr 08, 2008

great plugin. works perfectly.

i like the fact that when you refresh, it goes back to the same section. but for what i'm developing, i need to turn it off and on fresh, return to the 1st section. this is a problem w/ FF. Works OK on IE n O.

is this doable. help please

Comment by renderblender, Apr 13, 2008

This is a great plugin if you're using the Prototype framework.

For all you Mootools lovers (me being one of them) there's a Mootools version here: http://zendold.lojcomm.com.br/icarousel/

Comment by niels.doering, May 06, 2008

Great Script!

I only have one Problem: I use 3 gliders, but only one is visible at a time. To change between them, there is a tab navigation which uses .show() and .hide() (prototype functions). In Safari, each glider gets back to the first "page", when you use .hide() and make him visible again. Other browsers keep the last page. Is there any chance to solve this problem for Safari?

Example: Click on Tab2 makes Glider2 visible. Navigating to his second page. Back to Glider1 (Glider2.hide(); Glider1.show()) and then again Glider2 (Glider2.show(); Glider1.hide()). Now Glider2 shows his first page, but only with Safari. All other browsers still show page 2.

Comment by m...@datasteps.com, May 07, 2008

Very cool class this is for sure. I would like to know if anyone has tried to make this dynamic? I Would like to be able to add more content to the Glider through ajax? I believe all I need is an add method to this class

Comment by kigster, May 09, 2008

Just posted an issue with a patched version of glider.js to support multiple on-glide observers.. Very easy to hook up multiple updates to the HTML when someone slides to the next section.

Comment by fred...@lounge24.se, May 12, 2008

I've found a way to use the "lightbox effect" together with Glider.js. Check out http://www.dolem.com/lytebox/ Works out of the box :)

Comment by afri-...@zahav.net.il, May 28, 2008

How does the auto glide work where do I insert the code "{autoGlide: true, frequency: 4}"

Comment by lbarb...@insitaction.com, Jun 19, 2008

"Next" and "Prev" only work with prototype 1.5.1.

I need to use prototype "1.6.0.2" and it doesn't work anymore !! Who has an idea ???

Thanx

Comment by giovanni.sposito, Jun 24, 2008

Answer to : How does the auto glide work where do I insert the code "{autoGlide: true, frequency: 4}"

var feed = new Glider('feed', {autoGlide: true, frequency: 5});

Comment by francescu.santoni, Jun 24, 2008

goTo: function(index) {

this.moveTo(this.sectionsindex?, this.scroller, {duration: this.options.duration});
},

Comment by lbarb...@insitaction.com, Jun 25, 2008

Thanx francescu.santoni ;)

But i tried and it doesn't work :(

Can you be more precise please ? "Replace ... with ..." for example

THANX

Comment by jrotondo38, Jul 01, 2008

I'm also having difficulty getting the auto function to work. Can someone please post exact details on what needs to be changed, or how the variable needs to be fed? Many thanks!

Comment by jrotondo38, Jul 01, 2008

False alarm. I figured it out. This needs to be placed in the script on the page that triggers the script, i.e.:

<script type="text/javascript" charset="utf-8">

var my_glider = new Glider('my-glider', {autoGlide: true, frequency: 5});
</script>

Comment by isotope.dsmith, Jul 15, 2008

If you're having issues remember 2 things:

1) You have to initialise the glider onload like the comment above! 2) To make the glider start on a particular section you need to use the following:

initialSection: 'section1' // give id of section you want to start with

...in your onload call

Comment by jul...@negmotion.com, Jul 21, 2008

Hello everybody !

Glider.js is a very good script ! It works fine on i.e but there is a graphical bug on firefox when using iframe on the sliding pages. Has anyone have already notices this problem ? This is a link to see the graphical bug (only on firefox, it works fine on i.e): http://www.negmotion.com/TEST/ How to correct this problem ?

Comment by cswong, Jul 22, 2008
  goTo: function(index) {
    this.moveTo(this.sections[index], this.scroller, {duration: this.options.duration}); 
    },

To implement

<a href="#" onclick="my_glider.goTo('1'); return false;">1</a>
Comment by fred...@lounge24.se, Jul 28, 2008

When using auto glide, add the duration to the same script. Otherwise the auto glide & glide will be slow, at least in Safari.

Example (fast one);

<script type="text/javascript"  charset="utf-8">
var my_glider = new Glider('my-glider', {autoGlide: true, frequency: 5, duration: 0.5});
</script>

Is it possible to pause the auto glide during mouse over?

Comment by fred...@lounge24.se, Jul 28, 2008

Is this possible;

1) To pause the auto glide during content mouse over?

2) To pause the auto glide after prev or next click? It only pause when clicking a link to a section, not when using for example;

<a href="#" onClick="my_glider.previous();return false;">Previous</a>
Comment by jimzisk, Jul 30, 2008

I am using Glide 0.0.3 and I'd like to know how to get the control links to apply the active class when a section is active as it changes via autoGlide. Any suggestions to a solution is appreciated.

Comment by jimzisk, Jul 30, 2008

I also have Glider 0.0.4 with the same issue ... please send an example if possible.

Comment by 15balas, Aug 26, 2008

for choose the initial section:

<script type="text/javascript" charset="utf-8">

var my_glider = new Glider('my-glider', {duration:0.5, initialSection:'section1'});
</script>

Comment by johnatan.modesto, Sep 12, 2008

In glider properties, is it possible to change the animation direction to up and down?

Comment by blamourere, Sep 17, 2008

how would you use the "continuous" glide option ???

if (this.options.continuous && !this.element.ext ) {
this.element.cleanWhitespace(); this.element.ext=true; this.element.appendChild(this.element.firstChild);
}

I guess this adds the 1st element to the end of the container, but it seems I can't get it to work :/

How one would use this "continuous" option?

regards

Comment by kigster, Sep 30, 2008

A patched version available here: http://www.infectious.com/javascripts/glider.js

Added the following: - ability to specify observers to update item/page counts - key press observers for LEFT and RIGHT moving the slider (should be updated if vertical is desired)

Example usage with page range updater (5 items per page, 5 initially shown, 31 total):

	var designGlider = new Glider('scrollableDesignContainer', {
			duration:0.9, 
			autoGlide:false, 
			changeObservers: [ new PageRangeUpdater($('page-range'), 5, 5, 31) ],
			frequency:1,
			initialSection: 'section1'});

	// add click handlers to design thunbnails
	Event.observe(window, 'load', function(event) {
		designGlider.addKeyPressObserver();
		designSelector.addClickHandlers();
	});

See Infectious.com for usage.

Comment by alex.z...@inwind.it, Oct 06, 2008

Would you please give me some advices about pausing the slide on one panel during mouseover? I'm not a javascript expert but I like so much your script and after 4 hour of work i didn't take anything out of this... bye!

Comment by quankwango, Nov 10, 2008

hi

i don't know if this has been mentioned, but changing the onClick(as is in the download code) to onclick will allow your code to validate. maybe important to standards freaks if no-one else...

this script rocks, thank you :)

Comment by drewisme, Nov 15, 2008

I noticed a few people having some trouble stopping the autoGlide.

<div id="my-glider" onmouseover="my_glider.stop();return false;">

</div>
Comment by adam.lapczynski, Nov 17, 2008

how can i make the carousel continuous so when at the end, and you click next, it slides forward to loop the carousel instead of jumping back to the first section. it would be a lot smoother this way.

Comment by fred...@lounge24.se, Nov 19, 2008

I want to place a small static picture (not supposed to scroll) on top of the glider. I've tried with a new div under div id="my-glider" but I can't get it to work.

Please anyone, give me a css example. Thanks! :)

Comment by nathanielchang, Nov 21, 2008

this is great, but how do you get two to work on the same page?

Comment by designerfied, Nov 28, 2008

A couple of examples that I made. This slider is just what I needed!!Thank you for building this!

You can download them if you like. http://designerfied.com/customized-sliding-carousel-for-prototype.html

Comment by terrymunweihao, Nov 30, 2008

Hey there. Thanks for sharing this code, it has helped me a lot in the designing of my new Wordpress theme. The glider allows me to squeeze a considerable amount of information into a small space, and I think that's the part in which it shines :) you can see it in action over at my blog: http://www.teddy-o-ted.com.

Thanks again for this wonderful code!

Comment by nick.nikolai, Jan 01, 2009

The glider script that I installed on my site http://www.omnibusdesign.ru/package/ It's great, but it seems that it doesn't work in Opera. I wonder is this is a bug or a feature? :) In other words, does Glider Script work in Opera or not? Could anyone in the know comment on this?

Comment by louis.a1dezine, Jan 27, 2009

A great script! I have meet a problem: with autoGlide turned on, when I manually click on the controller links, the slider will double the rotating action in order to get to the right slide. This only happens in IE7 and works perfectly in FF. Can anyone here give a hand? Thanks in advance.

Comment by eddiehollenbeck, Jan 28, 2009

Hey! I love this script but I just ran into an issue with IE8. I have several slides that navigate through perfectly on IE7 and FF but when in IE8 it only goes through about half the slides before returning to the start. Has anyone else experienced this issue?

Comment by jrotondo38, Feb 18, 2009

Has anyone figured out how to add a pause function?

Comment by sarahmster, Feb 19, 2009

@jrotondo38, the following works for me: <a href="#" onclick="my_glider.stop();return false;">Pause</a>

Comment by jrotondo38, Feb 20, 2009

Thanks Sarahmstr, but that's more of a stop function than a pause. I guess I'll have to create a button that swaps a div to stop it, and a div to start it again.

Comment by jrotondo38, Feb 20, 2009

Has anyone tried to add Scriptaculous transitions to this script rather than using the built-in glider transition between divs?

Comment by terrymunweihao, Feb 20, 2009

I don't know if this is useful or not, but I wrote a tutorial on implementing the script on my blog after a reader requested for it ;) Compacting contents using Glider script

Comment by pre...@sweber.org, Mar 01, 2009

i have a error

Error: element.dispatchEvent is not a function File: prototype.js Line: 3972

if (document.createEvent) {
element.dispatchEvent(event);
} else {
element.fireEvent(event.eventType, event);
}

Can anybody help me?

Comment by terrymunweihao, Mar 03, 2009

Are you using the latest version of Prototype and effects.js file?

Comment by janusc, Mar 09, 2009

The script dosn't work on the example page

Comment by c4uonline, Mar 22, 2009

major issue wirh RTL , cant use this script when change dir to rtl , any ideas??? it stops responding.. shalom_israel (a@t) (hotmail) thanks.

Comment by c4uonline, Mar 22, 2009

it only works on FF and doesnt work on ir or chrome even

Comment by arp690, Mar 31, 2009

can somebody help me with this: http://www.extranews.net/news.php?nid=4720, in IE the 300x250 banner doesn't show correctly after sliding, if any body knows the problem send me a mail to albert_690@hotmail.com. Thanks!

Comment by pmsaue0, Apr 15, 2009

Has anyone made any progress on continuous looping of the items? Here is the test case I am working with: http://pastie.org/447526

I'd like the action to be that at the end of the sequence it continues to the first item instead of scrolling back to the beginning. Several people have requested this feature already, I know

thanks

Comment by robotbopbop, May 13, 2009

Has anyone had any luck getting two sliders to work on the same page?

Comment by robotbopbop, May 13, 2009

nevermind! I got it sorted.

Comment by kickflip59, Jun 21, 2009

I am not sure what I have done wrong, but my Glider has issues. Its not scrolling from image to image smoothly. And when you click I click on the link to go to the next page, the page jumps down as if it is moving to an anchor within the page. Here is the link: http://www.askewmedia.net/portfolio

Please help. Thanks!

Comment by sarahmster, Jun 24, 2009

@kickflip59: Don't know if this is all that's wrong, but try changing the order in which your js files are called. Prototype must be called before Scriptaculous, and Scriptaculous must be called before Effects. Then call the glider. You may also have conflict with the JQuery library; I'm not sure Proto-Scripty and Jquery are compatible on the same page. Good luck!

Comment by emailgershon, Jul 21, 2009

I am trying to add to my magento store http://www.thepromohut.com could this work with that script? Thanks

Comment by lukewilde, Aug 06, 2009

Hi guys,

I was pretty sure I had this sorted untill I saw it in IE 6 & 7. All the images appear to the side of the app and the navigation refuses to work. http://www.pssmr.co.uk/smrdigital

I know that it should work in IE 6, so does anyone have any idea what I've done?

Comment by lukewilde, Aug 07, 2009

Okay, well my problem was that I made each section position relative which allowed me to absolutly position text to each slide. IE 6 & 7 hated this and I'm finding it very difficult to find a work around.

Any ideas why sections cannot be position relative?

Comment by t...@labonita.at, Oct 17, 2009

after ie8 update anchors work wrong - some work some not - is there any solution ?

Comment by assafiri.m, Oct 17, 2009

I've noticed there is Opacity rendering in effect.js , can we use this to create a fading slideshow?

Comment by taphop.net, Oct 20, 2009

thanks for sharing. http://taphop.net

Comment by polilang.co.uk, Oct 31, 2009

Great script. I've used it (and obviously abused a bit :)) on my page but I've got problem with IE8 (IE7 works fine, not yet sure with IE6): pressing 'next' / 'prev' doesn't slide to proper sections and makes everything confusing. Try for yourself: http://polilang.co.uk/one2one

Comment by polilang.co.uk, Oct 31, 2009

Forgot to add: it obviously works great with other browsers. Anybody knows why it is not working on IE8? Appreciated!

Comment by polilang.co.uk, Oct 31, 2009

Ok, sorry for spamming - last bit, I promise: it is working fine on IE8 on localhost, but not on http://polilang.co.uk domain. So confusing!

Comment by polilang.co.uk, Nov 01, 2009

Ok, I've found a problem's source, probably related to IE8 October's security patch (KB974455 - I found this information here: http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/0ff6bf47-a028-4f96-a3a0-fc373d5acb19). Basically I've debugged the script on IE8 and FF 3.5 and found that 'scrollerContent' (which is the same as 'content' in Glider's demo - the one with large width and zero height) on IE8 returns negative offset! So Prototype Position.cumulativeOffset returns incorrect value, messing the slider.

I've put temporary workaround on my form (http://polilang.co.uk/one2one), checking if 'scrollerContent' offset is negative and reverting it in Position.cumulativeOffset calculation (you can check this in source code).

Hopefully you find this information useful and maybe MS will fix this soon...


Sign in to add a comment
Hosted by Google Code