No addition of css in jquery



  • Hey, everybody.

    There's a jQuery code :

    var parent = $(this).parents('.work-examples__li');
                var tarGet = parent.find(".example");
                var activeBlock = parent.find(".work-examples__li_active");
                var tarGetHeight = tarGet.height();
    
            if (!tarGet.hasClass('pop-up')) {
                tarGet.addClass('pop-up');
                activeBlock.addClass('visible');
                parent.css("padding-bottom", 'tarGetHeight')
    

    In the performance of the parent receives style="

    parent.css("padding-bottom", tarGetHeight)

    The padding receives 0px;

    What's the problem?



  • That's how it works.

    $(parent).css({"padding-bottom" : tarGetHeight});
    

    Prove. :

    UPDI didn't immediately notice. How do you use jQuery functions?




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2