1.11 code not working

a place to get help

Moderator: 1.1 Moderators

1.11 code not working

Postby vinchenzison on Fri Sep 04, 2009 7:17 pm

Hi All,

Spent best part of the day trying to fix this, scanning the web for hints and tips but I'm still struggling.
I'm using phpwcms so am restricted to mootools 1.11 at the moment.

All I'm trying to do is hide and show divs. Simple right.
Here is my code:

  1. window.addEvent('domready', function() {
  2. var mySlide1 = new Fx.Slide('mediaGal');
  3. var mySlide2 = new Fx.Slide('mediaMP3');
  4. var mySlide3 = new Fx.Slide('mediaVideo');
  5. mySlide2.hide();
  6. mySlide3.hide();
  7.  
  8. var showgall = function () {   
  9.         mySlide2.slideOut();
  10.         mySlide1.slideIn();
  11.         mySlide3.slideOut();
  12. }
  13. var showmp3 = function() {
  14.         mySlide2.slideIn();
  15.         mySlide1.slideOut();
  16.         mySlide3.slideOut();
  17. }
  18. var showvid = function(e) {
  19.         mySlide2.slideOut();
  20.         mySlide1.slideOut();
  21.         mySlide3.slideIn();
  22. }
  23.     $('mp3gall').addEvent('click', showgall);
  24.     $('vidgall').addEvent('click', showgall);
  25.     $('gallmp3').addEvent('click', showmp3);
  26.     $('vidmp3').addEvent('click', showmp3);
  27.     $('gallvid').addEvent('click', showvid);
  28.     $('mp3vid').addEvent('click', showvid);
  29. });


Within my html file I have a link like

  1. <a href="#" id="mp3gall">MP3s</a>


On loading the webpage, mySlide1 and mySlide2 hide themselves as they should do. Problem I have is the links don't do anything. Nothing happens. The should hide the current Div and display a new one changing from Image Gallery to a page with MP3's on.

Can anyone help me! I'm near to tears with this :x

Just so I'm not being stupid, Fx.Slide is part of 1.11 isn't it? I first created this using 1.2.3 but then realised I had to use 1.11.

Thanks

Vince
vinchenzison
 
Posts: 3
Joined: Fri Sep 04, 2009 7:09 pm

Re: 1.11 code not working

Postby daKmoR on Fri Sep 04, 2009 7:22 pm

Fx.Slide had always been part of "More" (iirc) so to speak in 1.11 More

what error do you get in firebug?
demo?
"Speak when you are angry and you will make the best speech you will ever regret." - Ambrose Bierce
User avatar
daKmoR
Site Admin
 
Posts: 860
Joined: Mon Jul 14, 2008 11:40 am

Re: 1.11 code not working

Postby vinchenzison on Fri Sep 04, 2009 7:35 pm

Hi,

Not entirely sure how to check for errors with firebug.

I've added a {duration: 2000} to the initial closing of the mp3 and video div to check the effect works properly.
Click on the mp3 and video menu should slidein the relevant div and hide the others.

I can't believe it - must be the lack of Tea and food today.
I thought I'd setup all the links required but had only done 3 instead of the 6 defined in my JS. Commented out them and it's all sorted now.
Hours and stupidity!!!! :oops:
Last edited by vinchenzison on Fri Sep 04, 2009 7:42 pm, edited 1 time in total.
vinchenzison
 
Posts: 3
Joined: Fri Sep 04, 2009 7:09 pm

Re: 1.11 code not working

Postby daKmoR on Fri Sep 04, 2009 7:40 pm

install latest FireFox, get latest FireBug

open console and you will see:
$("vidgall") is null
[Break on this error] $('vidgall').addEvent('click', showgall);\n
"Speak when you are angry and you will make the best speech you will ever regret." - Ambrose Bierce
User avatar
daKmoR
Site Admin
 
Posts: 860
Joined: Mon Jul 14, 2008 11:40 am

Re: 1.11 code not working

Postby vinchenzison on Fri Sep 04, 2009 7:42 pm

Thanks - realised my stupidity
vinchenzison
 
Posts: 3
Joined: Fri Sep 04, 2009 7:09 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest