javascript - How to change css properties depending on parent, but with the same class name -
an example: i've got feed on website, feeds using same css classes, , images have different height. , need height of each of images , depending on set bottom property menu, @ bottom of each image on feed.
i plan use javascript.
i stacked on issue. i'm wondering how set bottom property each menu_div
, depending on images… main problem how set of them, beacause images different.
feed looks this:example
and not particular case, method.
firstly, highly recommend using zepto or jquery instead of using pure javascript. secondly, there's way accomplish want html , css. if share code, you've tried , you're trying may able better. since have question javascript here how can accomplish you're asking in jquery:
$('.feed_css_class').each(function() { // height of image in feed var imageheight = $(this).find('img').first().height() // set bottom of .menu_div $(this).find('.menu_div').css('bottom', imageheight + 'px'); });
Comments
Post a Comment