Javascript Help

Discussion in 'HTML & Website Design' started by gbabula, Nov 12, 2007.

  1. #1
    Whats up guys, I'm going to assume that someone here knows Javascript.

    I'm having a problem, I cant get one of my slides in my Accordion (mootools) to intially stay open. I want the "about us" slide to be open when someone first visits my page. The weirdest part is that when someone visits the page all slides are folded, but when you refresh the "about us" slide comes out.


    This is the MooTools Accordion Page : http://demos.mootools.net/Accordion

    I would love all the help I could get, I can't figure this one out.



    Here is my Javascript:


    window.addEvent('domready',function(){
    		var actif=Cookie.get('openslide');
     
    		//if actif ( cookie.get('openslide') ) equals /false/ setcookie to 0 to show first item in accordian
    		if(actif==false){
    			Cookie.set('openslide',0);
    		}
     
    		var yourSlides=$$('.slide');
    		var togslide=$$('.tog');
     
    		yourSlides.each(function(el,i){
    			var slider=new Fx.Slide(el);
    			slider.hide();
     
    			if(actif&&actif==i){
    				slider.show();
    			}		
     
    			togslide.each(function(elem,j){
    				elem.addEvent('click',function(e){
    					e=new Event(e).stop();
    					if(j==i){
    						slider.slideIn();
    						Cookie.set('openslide',i);
    					}else{
    						slider.slideOut();
    					}
    				});
    			});
    		});
    	});
    Code (markup):
    Here is my HTML:

     
    gbabula, Nov 12, 2007 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    i can help if you pay me $10 by paypal

    Regards

    Alex
     
    kmap, Nov 12, 2007 IP