Advertisement
johncarlson21

Motozz Shop By JS Fix

Jul 16th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // this code to add accodion effect to shopby option
  2.             jQuery( document ).ready(function( $ ) {
  3.                 $('#narrow-by-list .accodion-main').first().addClass('active');
  4.                 $('#narrow-by-list .accodion-sub').first().addClass('active');
  5.                 $('#narrow-by-list .accodion-sub').first().css('overflow','hidden');
  6.                 $('#narrow-by-list .accodion-sub').first().data('autoHeight',$('#narrow-by-list .accodion-sub').first().height()).css('overflow','hidden');
  7.                 $('#narrow-by-list .accodion-sub:gt(0)').each(function(){
  8.                     $(this).css('overflow','hidden');
  9.                     $(this).data('autoHeight', $(this).height());
  10.                     //$(this).css('height','auto').data('autoHeight',$(this).height()).css('height','0px').css('overflow','hidden');
  11.                     $(this).css('height','0px'); //.css('overflow','hidden');
  12.                     $(this).addClass('inactive');
  13.                 });
  14.                 $('#narrow-by-list .accodion-main').click(function(){
  15.                     if ($(this).hasClass('active')){
  16.                         $(this).removeClass('active').addClass('inactive');
  17.                         $(this).next('.accodion-sub').removeClass('active').addClass('inactive');
  18.                         $(this).next('.accodion-sub').animate({height: 0},400,"swing");
  19.                     }else{
  20.                         $/*('#narrow-by-list .accodion-main').removeClass('active').addClass('inactive');
  21.                         $('#narrow-by-list .accodion-sub').removeClass('active').addClass('inactive');*/
  22.                         $(this).removeClass('inactive');
  23.                         $(this).addClass('active');
  24.                         sub = $(this).next('.accodion-sub');
  25.                         sub.removeClass('inactive').addClass('active');
  26.                         sub.animate({height: sub.data('autoHeight')},400,"swing",
  27.                             function(){
  28.                                 //$(this).prev('.accodion-main').addClass('active');
  29.                             });
  30.                     }
  31.                 });
  32.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement