Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
owl Carousel no funciona después del éxito de ajax en python Django

Quiero obtener la lista de categorías principales en el control deslizante haciendo clic en la lista deslizante de la categoría principal. el sider de la segunda categoría no funciona cuando hago clic en la categoría principal.

$('.categoría principal').owlCarousel({ });

 $(".box").on("click", function(){ var value= this.id.toString(); var csr =$("input[name=csrfmiddlewaretoken]").val(); debugger $.ajax({ url: 'getParentCategory', type: 'POST', data: { id: value, csrfmiddlewaretoken: csr }, success: function (response) { data = response.results AppendData(data); } }); }); function AppendData(data){ $(".secondCategory").empty(); debugger; var htmls = ''; if(data.length != 0){ for (var i = 0; i < data.length; i++) { htmls += '<div class="item eight-card-single text-center">' htmls += '<a id="{{value.id}}" class="second-category category">' htmls +='<img src="/media/uploads/products/logo.jpg">' htmls +='<h5 id="'+ data[i].name +'" class="card-title">'+ data[i].name +'</h5>' htmls +='</a>' htmls +='</div>' } $(".secondCategory").append(htmls); $('.secondCategory').owlCarousel({ }); } else { $(".secondCategory").append("No data"); } };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El método .empty() borra el contenido del elemento pero no destruye la instancia de carrusel de Owl existente en ese elemento, debe hacerlo con $(".secondCategory").trigger("destroy.owl.carousel") antes de configurar el nuevo html y creando una nueva instancia de carrusel de Owl.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!