Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9052663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:14:04+00:00 2026-06-16T13:14:04+00:00

I’m trying to use a bit of code in a CMS page, I put

  • 0

I’m trying to use a bit of code in a CMS page, I put the bit of code in the end of the html code implemented in the CMS page that I created in Prestashop Backoffice, however, parts of that code work but the rest of the code doesn’t work and don’t know why.

So basically I have a page with a list and some divs inside of each item of the list. So with jQuery I hide all the DIVs (and this particular part works) and then in each item that I click I have a jQuery function to toggle visibility of the DIV beneath. So the problem is here, that bit of code seems that doesn’t work, and I don’t know why.

<h1>Cursos Magic Nails</h1>
<p>Temos um vasto leque de ofertas formativas à sua espera. Escolha um dos links abaixo e veja a nossa oferta formativa.</p>
<ul id="portefolio">
<li><img name="" src="" width="256" height="200" alt="" />Unhas
<div class="infos">
<h3>Cursos de Unhas de Gel e Acrílico</h3>
<ul>
     <li>Curso de Técnicas de Unhas de Gel</li>
        <li>Designer de Unhas de Gel</li>
        <li>Curso de Art-Nail</li>
        <li>Reciclagem para Profissionais</li>
</ul>
<ul>
     <li>Curso de Acrílico</li>
</ul>
</div>
</li>
<li><img name="" src="" width="256" height="200" alt="" />Manicure/Pedicure
<div class="infos">
<h3>Cursos de Manicure/Pedicure</h3>
<ul>
     <li>Curso de Manicure</li>
        <li>Curso de Pedicure</li>
        <li>Pack 3 Cursos (Manicure/Pedicure e Depilação)</li>
        <li>Curso 3 em 1<span>PROMO</span></li>
        <li>Manicure e Pedicure<span>PROMO</span></li>
</ul>
</div>
</li>
<li><img name="" src="" width="256" height="200" alt="" />Pestanas
<div class="infos"> 
<h3>Cursos de Pestanas</h3>
<ul>
<li>Curso de Alongamento de Pestanas<span>NOVO</span></li>
<li>Curso de Permanente de Pestanas<span>NOVO</span></li>
</ul>
</div>
</li>
<li><img name="" src="" width="256" height="200" alt="" />Depilação
<div class="infos">
<h3>Cursos de Depilação</h3>
<ul>
<li>Curso de Depilação</li>
<li>Curso de Depilação com Linha<span>NOVO</span></li>
<li>Curso de Depilação<span>PROMO</span></li>
</ul>
<ul>
<li>Pack 3 Cursos</li>
<li>Curso 3 em 1<span>PROMO</span></li>
</ul>
</div>
</li>
<li><img name="" src="" width="256" height="200" alt="" />Massagens
<div class="infos">
<h3>Cursos de Massagens</h3>
<ul>
<li>Curso de Massagens de Relaxamento</li>
<li>Curso de Massagens das Pedras Quentes</li>
<li>Curso de Massagens de Estética</li>
</ul>
</div>
</li>
<li><img name="" src="" width="256" height="200" alt="" />Rosto
<div class="infos">
<h3>Cursos de Rosto</h3>
<ul>
<li>Curso de Rosto</li>
</ul>
</div>
</li>
<li><img name="" src="" width="256" height="200" alt="" />Glitter Tattoo
<div class="infos">
<h3>Cursos de Glitter Tattoo</h3>
<ul>
<li>Curso de Glitter Tattoo</li>
</ul>
</div>
</li>
</ul>

And the jQuery embedded in the page:

<script type="text/javascript">
    $(document).ready(function() {
        //Hide that DIV
        $('#page #portefolio li .infos').hide(); //Hide/close all containers


        //On Click
        $('#page #portefolio li').click(function(){
            //If immediate next container is closed...
            if($(this).parent('#page #portefolio li .infos').is(':hidden')){ 
                $('#page #portefolio li').removeClass('active').parent('#page #portefolio li .infos').slideUp();
                $(this).addClass('active').parent('#page #portefolio li .infos').slideDown();   
            } else {
                $(this).removeClass('active').parent('#page #portefolio li .infos').slideUp();
            }
            return false; //Prevent the browser jump to the link anchor
        });
    });
</script>

So the part above //On Click is the part that doesn’t work.

You can test that in this link:
Link

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:14:05+00:00Added an answer on June 16, 2026 at 1:14 pm

    Your main problem is the way you’re traversing to find the right .infos divs. jQuery has pretty elegant traversal methods that can make this a lot simpler.

    Here’s a live example: http://jsfiddle.net/WbUPt/1/

    // Cache your jQuery selector... you don't need to find it over and over again
    var $portefolio = $('#portefolio');
    
    // Hide / close all containers
    $portefolio.find('.infos').hide(); 
    
    // Add a single event to the container for better performance
    $portefolio.on('click', 'li', function (event) {
    
        var $this = $(event.currentTarget);
    
        if ($this.hasClass('active')) {
    
            // Deactivate
            $this.removeClass('active');
            $this.find('.infos').slideUp();
    
        } else {
    
            // Activate
            $this.addClass('active');
            $this.find('.infos').slideDown();
        }
    });
    

    ​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.