javascript - tumblr - How can I make a div appear based on the height of a certain post's caption? -
i editing theme on tumblr , trying use jquery make div appears if height of text post or post's caption on 250px. pretty simple , seems working, seems take in first post , sets div visible other entries too. know how can adjust code each post goes through code instead of being set first post only?
note: #entry id that's being used styling posts. .caption caption's class , .b div want shown if caption on height.
$(document).ready(function(){ if ($("#entry .caption").height()>250) { $("#entry .b").show(); } });
please let me know if can help. thanks!
try change
if ($("#entry .caption").height()>250)
to:
if ($("#entry .caption").height()>=250)
so match 250px
of height , above.
and each element matches:
$(document).ready(function(){ $('.entry .caption').each(function(i, ui){ if ($(this).height()>=250) { $(this).parents('.entry').find('.b').show(); } }); });
Comments
Post a Comment