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 : accordion external link, open accordion external link, open text, slide html jquery, hide div javascript, html add div, jquery hide divs, accordion panel, div add html, jquery quot, load external menu, html accordion, jquery slide menu, jquery open page, open add, link remove, jquery div load html, page load action

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

N° du projet : #2400236

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

stolho

Hired by the Employer

50 $ USD en 2 jours
(10 Commentaires)
4.6