Probléme avec code javascript dans une page asp

oussama112 Messages postés 8 Date d'inscription vendredi 3 décembre 2010 Statut Membre Dernière intervention 29 octobre 2012 - 19 mai 2012 à 13:56
oussama112 Messages postés 8 Date d'inscription vendredi 3 décembre 2010 Statut Membre Dernière intervention 29 octobre 2012 - 23 mai 2012 à 22:53
Catégories




<li >
[ Cuisson]

<li >
[ Cuisiniere]
</li>
<li class="last">
[ Cuisiniere inox]
</li>

</li>


<script type="text/javascript">
// <![CDATA[
// we hide the tree only if JavaScript is activated
$('div#categories_block_left ul.dhtml').hide();
// ]]>
</script>







j'ai un souci avec le script qui marche pas je sais pas pourkoi. s'il vous plait est ce qu'il y a quelqu'un qui peut m'aider. Merci infiniment

2 réponses

Tupad Messages postés 239 Date d'inscription lundi 5 décembre 2005 Statut Membre Dernière intervention 27 août 2012 5
21 mai 2012 à 09:24
ca fonctionne chez moi.

Tu n'aurais pas oublié de référencer la librairie jquery dans ton code?

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" language="javascript"></script>
</head>
0
oussama112 Messages postés 8 Date d'inscription vendredi 3 décembre 2010 Statut Membre Dernière intervention 29 octobre 2012
23 mai 2012 à 22:53
oui c'est déjà fais et voilà le code jquery


//animate the opening of the branch (span.grower jQueryElement)
function openBranch(jQueryElement, noAnimation) {
jQueryElement.addClass('OPEN').removeClass('CLOSE');
if(noAnimation)
jQueryElement.parent().find('ul:first').show();
else
jQueryElement.parent().find('ul:first').slideDown();
}
//animate the closing of the branch (span.grower jQueryElement)
function closeBranch(jQueryElement, noAnimation) {
jQueryElement.addClass('CLOSE').removeClass('OPEN');
if(noAnimation)
jQueryElement.parent().find('ul:first').hide();
else
jQueryElement.parent().find('ul:first').slideUp();
}

//animate the closing or opening of the branch (ul jQueryElement)
function toggleBranch(jQueryElement, noAnimation) {
if(jQueryElement.hasClass('OPEN'))
closeBranch(jQueryElement, noAnimation);
else
openBranch(jQueryElement, noAnimation);
}

//when the page is loaded...
$(document).ready(function () {
//to do not execute this script as much as it's called...
if(!$('ul.tree.dhtml').hasClass('dynamized'))
{
//add growers to each ul.tree elements
$('ul.tree.dhtml ul').prev().before(" ");

//dynamically add the '.last' class on each last item of a branch
$('ul.tree.dhtml ul li:last-child, ul.tree.dhtml li:last-child').addClass('last');

//collapse every expanded branch
$('ul.tree.dhtml span.grower.OPEN').addClass('CLOSE').removeClass('OPEN').parent().find('ul:first').hide();
$('ul.tree.dhtml').show();

//open the tree for the selected branch
$('ul.tree.dhtml .selected').parents().each( function() {
if ($(this).is('ul'))
toggleBranch($(this).prev().prev(), true);
});
toggleBranch( $('ul.tree.dhtml .selected').prev(), true);

//add a fonction on clicks on growers
$('ul.tree.dhtml span.grower').click(function(){
toggleBranch($(this));
});
//mark this 'ul.tree' elements as already 'dynamized'
$('ul.tree.dhtml').addClass('dynamized');

$('ul.tree.dhtml').removeClass('dhtml');
}
});
0
Rejoignez-nous