Fermé

Open accordion panel with external link

I prefered a solution in jQuery:

I use the slideUp and slideDow funktion to generate an jQuery accordion. I need to open a panel with an external link. A link link this [url removed, login to view], where number match the number of the header in the accordion panel.

Ex.: [url removed, login to view], will slidedown/open the first panel and [url removed, login to view], will open the third panel

This is my HTML:

<div id="leftCol-3">

<div class="csc-header">

<h1>Header-1</h1>

</div>

<div class="accordionTrigger" id="link-1">body Text-1</div>

<div class="csc-header">

<h1>Header-2</h1>

</div>

<div class="accordionTrigger" id="link-2">body Text-2</div>

<div class="csc-header">

<h1>Header-3</h1>

</div>

<div class="accordionTrigger" id="link-3">body Text-3</div>

</div>

And this is my JavaScript (jQuery)

$(document).ready(function() {

//From [url removed, login to view]

// hide the divs on page load

$('#leftCol-3 div > .accordionTrigger').hide();

//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)

$('#leftCol-3 div .csc-header').click(function() {

//REMOVE THE ON CLASS FROM ALL BUTTONS

$('#leftCol-3 div .csc-header').removeClass('active');

//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES

$('.accordionTrigger').slideUp('normal');

//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT

if($(this).next().is(':hidden') == true) {

//ADD THE ON CLASS TO THE BUTTON

$(this).addClass('active');

//OPEN THE SLIDE

$(this).next().slideDown('normal');

}

});

});

Compétences : AJAX, Javascript

Voir plus : open javascript accordion external link, accordion external link, open div accordion external link, open accordion panel external link, open accordion external link, this class jquery, open text, jquery class, link accordion external link, jquery accordion open external link, what is open text, click button open link, slide html jquery, jquery button click load, hide div javascript, jquery button text, html add div, jquery hide divs, slide click slide click jquery, accordion panel, div add html, jquery quot, javascript document ready, load external menu, html accordion

Concernant l'employeur :
( 0 commentaires ) Copenhagen, Denmark

N° du projet : #2400236

1 freelance fait une offre moyenne de $50 pour ce travail

stolho

Hired by the Employer

50 $ USD en 2 jours
(10 Commentaires)
4.6