Jump to content

Has anyone come across this problem before?


spires

Recommended Posts

Hi Guys.

 

Please check out this site.

Check out http://www.spirestest.com/product2.php

 

HOW IT WORKS:

Whats happens is the 'more information >>' button will start the mootools scroll effect.

There are 7 areas that get scrolled through. The 'more information >>' button only appears

in the first area. After that the button chages to '' = Next area.

 

THE PROBLEM:

Each of the buttons use an 'id' this determines which area will show.

For Example id="link3" will go to 'area 3'.

But whats happening is, I can only use the id="***" once on the page.

If I use it for a second time, only the link that appears first is active.

The second link, does nothing.

 

STRUCTURE:

* = Does not work.

>> = id="link2"

<< = id="link1" | >> = id="link3"

<< = id="link2"* | >> = id="link4"

<< = id="link3"* | >> = id="link5"

<< = id="link4"* | >> = id="link6"

<< = id="link5"* | >> = id="link7"

<< = id="link6"* | >> = id="link1"*

 

As you can see, If the link has all ready been used higher up the list,

the second time it's used, it will not work. Why is this?

 

Please can some one shed some light on this.

I am completely stuck, and would love to hear your thoughts on this.

 

Thanks for all your help.

:-)

Link to comment
Share on other sites

mootools has great selectors.

 

what you could do is give the links that control the scrolling action the same class name and give them unique ids

 

<a link="#" class="scroller_link" id="link:1">link</a>

 

then use the $$ selector to select all of those links

 

$$('.scroller_link').each(function(link){

var scroll = this.id.split(':');

link.addEvent('click',function(e){

e = new Event(e).stop();

scroll.toElement('content' + scroll[1]);

});

});

 

hopefully that will work for you. use those few lines to replace each addevent for every link ele that you have

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.