Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10004765
    gifbox
    Participant

    Hi,

    I created an Header.php and a footer .php for my website.
    Everything works well except the class active on my different links.

    I tried to use this solution : (works good)
    <li <?php if($pageactive == ‘index’) { echo ‘ class=”active”‘; } ?>>
    Accueil

    (with : <?php $pageactive = ‘index’; ?> on my index page)

    but it doesn’t work with the dropdown-menu or subcategories. the dropdown works when I click on it but not on the hover ?

    Do you have any solutions ?

    Thanks


    #10004777
    Support
    Keymaster

    Hello, when you set the active class in an item that has a dropdown you need to keep both classes, like this:

    Please let me know if you meant something else or if you have any other questions.

    Thanks 🙂


    #10004899
    gifbox
    Participant

    Hello,

    I’ve just tried to change the second level of li with “dropdown” class but i’have always the same problem.
    If you want to look the new version of my site with the header.php and footer.php it’s here

    Thanks


    #10004907
    Support
    Keymaster

    Hello, here’s a sample of a item with sub-items:

    <li class="dropdown">
    	<a class="dropdown-toggle" href="#">
    		About Us
    		<i class="fa fa-angle-down"></i>
    	</a>
    	<ul class="dropdown-menu">
    		<li><a href="about-us.html">About Us</a></li>
    		<li><a href="about-us-basic.html">About Us - Basic</a></li>
    		<li><a href="about-me.html">About Me</a></li>
    	</ul>
    </li>

    And this is when the active class is set:

    <li class="dropdown active">
    	<a class="dropdown-toggle" href="#">
    		About Us
    		<i class="fa fa-angle-down"></i>
    	</a>
    	<ul class="dropdown-menu">
    		<li><a href="about-us.html">About Us</a></li>
    		<li><a href="about-us-basic.html">About Us - Basic</a></li>
    		<li><a href="about-me.html">About Me</a></li>
    	</ul>
    </li>

    Please make sure you add the “dropdown” class as well in the parent item as shown above.

    Let me know if you have any questions.

    Thanks.


    #10004936
    gifbox
    Participant

    Hi,

    My Menu is on a header.php file.
    To generate the active class, I have tried ton insert php code in my html.

    <nav class="nav-main mega-menu">
         <ul class="nav nav-pills nav-main" id="mainMenu">
    
    	<li <?php if($pageactive == 'index') { echo ' class="active"'; } ?>>
    	<a href="index.php">Accueil</a>
            </li>
    
    	<li <?php if($pageactive == 'societe-artificiel-plafond-tendu-barrisol') { echo ' class="active"'; } ?>>
    	<a href="societe-artificiel-plafond-tendu-barrisol.php">La société</a>
    	</li>
    
        <li <?php if($pageactive == 'plafond-tendu') { echo ' class="dropdown active"'; } ?>>
    	<a class="dropdown-toggle" href="plafond-tendu.php">
    	Nos Produits
    	<i class="icon icon-angle-down"></i>
    	</a>
    	    <ul class="dropdown-menu">
    		<li<?php if($pageactive == 'plafond-tendu') { echo ' class="dropdown"'; } ?>>
    		<a href="plafond-tendu.php">Les Plafonds tendus</a>
    		</li>
    		<li<?php if($pageactive == 'plafond-tendu') { echo ' class="dropdown"'; } ?>>
    		<a href="murs-imprimes-artolis.php">Les Murs imprimés</a>
    		</li>
    		<li<?php if($pageactive == 'plafond-tendu') { echo ' class="dropdown"'; } ?>>
    		<a href="pourquoi-plafond-tendu-barrisol.php">Pourquoi choisir Barrisol</a>
    		</li>
    	    </ul>
           </li>
    
    	<li <?php if($pageactive == 'realisations-plafond-tendu') { echo ' class="dropdown active"'; } ?>>
    	<a class="dropdown-toggle" href="realisations-plafond-tendu.php">
    	Types de réalisations
    	<i class="icon icon-angle-down"></i>
    	</a>
    	    <ul class="dropdown-menu">
    		<li><a href="realisations-plafond-tendu.php">Tout voir</a></li>
    		<li><a href="realisations-plafond-tendu-salon.php">Salon</a></li>
    		<li><a href="realisations-plafond-tendu-cuisine.php">Cuisine</a></li>
    		<li><a href="realisations-plafond-tendu-salledebain.php">Salle de Bain</a></li>
    		<li><a href="realisations-plafond-tendu-chambres.php">Chambres</a></li>
    		<li><a href="realisations-plafond-tendu-autrespieces.php">Autres pièces</a></li>
    		<li><a href="realisations-plafond-tendu-professionnels.php">Professionnels</a></li>
    	    </ul>
    	</li>
    										
    	<li <?php if($pageactive == 'equipe-artificiel') { echo ' class="active"'; } ?>>
    	    <a href="equipe-artificiel.php">Notre Equipe</a>
    	</li>
    
    	<li <?php if($pageactive == 'contact-artificiel-plafond-tendu') { echo ' class="active"'; } ?>>
    	    <a href="contact-artificiel-plafond-tendu.php">Contactez Nous</a>
    	</li>
    
        </ul>
    </nav>

    I really don’t see where is my problem ? Do I change theme.js ? or anything else ?

    Thank you


    #10004953
    Support
    Keymaster

    Hello, the problems seems to be that you still need the dropdown class when the item is not active.

    For example:

    FROM:

    <li <?php if($pageactive == 'realisations-plafond-tendu') { echo ' class="dropdown active"'; } ?>>

    TO:

    <li <?php if($pageactive == 'realisations-plafond-tendu') { echo ' class="dropdown active"'; } else { echo ' class="dropdown"'; } ?>>

    Thanks.


    #10004963
    gifbox
    Participant

    YES !!! it’s works perfectely

    A Big Thanks for your Help !!

    Thanks


Viewing 7 posts - 1 through 7 (of 7 total)

This topic is marked as "RESOLVED" and can not rceive new replies.