Here is the code:

var fogot = true,counter = 0; for (var j = 0; j <= $('.flex-dir-row .one-good').length; j++) { alert(0); if((j % (2*6)) == 0){ $(".goods-container").css("height") = (parseInt($(".goods-container").css("height")) + 100) + "%"; } } $(".slide-button").click(function(){ if(counter <= Math.floor(j/12)){ $(".goods-container").css({"animation":"moveToTop 1s linear forwards"}); counter++; alert(1); } else { $(".goods-container").css({"animation":"moveToBottom 1s linear forwards"}); counter--; alert(0); } }); 

Closed due to the fact that off-topic participants are Vladimir Martyanov , Alexey Shimansky , Lex Hobbit , pavel , Cheg 22 Aug '17 at 17:22 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Vladimir Martyanov, Lex Hobbit, pavel, Cheg
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Specification: writes that the error on line 5. - Wale Wole
  • There is a править button in the messages (a small such text button under the message), and it’s better to use the edit to insert the message into the message itself - Rostyslav Kuzmovych

1 answer 1

Error using css method

It was :

 $(".goods-container").css("height") = (parseInt($(".goods-container").css("height")) + 100) + "%"; 

It is necessary:

 var h = (parseInt($(".goods-container").css("height")) + 100) + "%"; $(".goods-container").css("height", h); 

More details can be found here, for example, w3schools or api.jquery here

  • 2
    pay attention to the .css (propertyName, function) code will be much easier: $(".goods-container").css("height", (index, currentValue)=>`${parseInt(currentValue)+100}%`); - Grundy
  • @Grundy cool, I did not know, thank you! - Rostyslav Kuzmovych
  • most functions have an overload that accepts a function - Grundy