Establecer un margen basado en una variable agregada a un número
Frecuentes
Visto 75 veces
1 Respuestas
3
Prueba esto:
$("div.entry-content").css("margin-bottom", function(){
return $(this).next().outerHeight() + 12 + "px"
})
Respondido 25 ago 12, 15:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas jquery css height or haz tu propia pregunta.
@snuffn Yes, I had forgotten to write the return. - Carnero
Works like a charm, thanks! Do you mind explaining why a function is needed? - bram vanroy
@BramVanroy Because
this
in your code doesn't refer to your desired element,this
in the context of the function refers to the selected element, you can read about that in api.jquery.com/css/#css2 - CarneroThanks a lot! Will read it through when I have sufficient time. I bumped into a similar problem. If you have time, please look into it: stackoverflow.com/questions/12123267/… - bram vanroy