Trying to get same jquery arrow effect on different menu in same page

Discussion in 'jQuery' started by paladin884, Aug 29, 2014.

  1. #1
    Hello guys,
    I wonder if someone can help me fixing an accordion menu. Basically I have one accordion menu on the main page and when click on that menu the arrows change upside down and the sections open. I also have a top navigation menu and when click on any item open the content accordion section and it's scroll to it but it doesn't change the arrow upside down.

    This is the code for the main accordion:
    $('.accordion').click(function(){var nextbody = $(this).next('.accordion-body');
    changearrow(this);
    $(this).next('.accordion-body').slideToggle();


    });


    function changearrow(divv){if($(divv).next('.accordion-body').css('display')==='none'){
    $('.accarrow',divv).html($('.accarrow',divv).html().replace('accarrow','accarrowup'));
    $('.accarrow',divv).addClass('accup');

    }else{
    $('.accarrow',divv).html($('.accarrow',divv).html().replace('accarrowup','accarrow'));
    $('.accarrow',divv).removeClass('accup');

    }}

    This is the code from the top menu:
    $('.button1').click(function(e){
    e.preventDefault();
    $('.active').removeClass('active');
    $(this).addClass('active');
    $('#contactus').slideUp();
    $('#casestudies').slideUp();
    $('#trackrecords').slideUp();
    $('#newsbody').slideUp();
    dataslide =1;
    $('#assman').slideDown();
    $('#services').slideDown(function(){goToByScroll(dataslide);});

    });

    Any idea how can I achieve this?

    Thanks a lot!
     
    paladin884, Aug 29, 2014 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    Can you place all of this into a js fiddle?
     
    HuggyStudios, Aug 30, 2014 IP