Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-14-2010, 06:31 PM   PM User | #1
trevorhoullier
New to the CF scene

 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
trevorhoullier is an unknown quantity at this point
Angry Mootools Carousel problems!

Hi there

The carousel I'm using on my site is skipping an image when I click on the 'next' arrow ie. #1 > #3 > #5 > #7.... The 'prev' arrow just isn't working fullstop.

I'm a total novice at Javascript, so I'm at a total loss as to how I can fix this.

Here's my site:
http://stuseddon.co.uk/

Here's my javascript:
[CODE]window.addEvent('domready', function() {
$$('.images').each(function(div) {
var images = div.getElements('img');

if(images.length > 1) {
images.each(function(img, i) {
img.set('morph', {duration: 500, link: 'cancel'});

if(i > 0) {
img.setStyle('opacity', 0);
}
});

var e = images.length * 1000;

var prev = new Element('a', {'class': 'prev'}).inject(div);
var next = new Element('a', {'class': 'next'}).inject(div);

var arrows = $$(prev, next);
arrows.setStyle('opacity', 0).set('morph', {duration: 100, link: 'cancel'});

div.addEvents({
mouseenter: function() {
arrows.morph({opacity: 0.33});
},
mouseleave: function() {
arrows.morph({opacity: 0});
}
});

arrows.addEvents({
mouseenter: function() {
this.morph({opacity: 1});
},
mouseleave: function() {
this.morph({opacity: 0.33});
}
});

prev.addEvent('click', function() {
e--;

images.morph({opacity: 0});
images[e % images.length].morph({opacity: 1});
});

next.addEvent('click', function() {
e++;

images.morph({opacity: 0});
images[e % images.length].morph({opacity: 1});
});

div.addEvent('click', function(e) {
if($(e.target).get('tag') != 'a') {
next.fireEvent('click');
}
});

div.addEvent('selectstart', function(e) {
e.stop();
});
}
else {
div.setStyle('cursor', 'default');
}
});
});[CODE]

Please help! Thanks in advance.
trevorhoullier is offline   Reply With Quote
Old 04-15-2010, 10:30 AM   PM User | #2
trevorhoullier
New to the CF scene

 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
trevorhoullier is an unknown quantity at this point
All resolved now.
The JQuery was clashing with Mootools!
trevorhoullier is offline   Reply With Quote
Reply

Bookmarks

Tags
carousel, gallery, javascript, mootools

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:09 PM.


Advertisement
Log in to turn off these ads.