📜 ⬆️ ⬇️

Align blocks to height (Bug in Safari) HTML + jQuery

Good day to all Harb users!

At the moment I am engaged in the layout of one project, and the front-door task is to deploy blocks with rounded corners, while ensuring that their heights are the same.

For this, I decided to use jQuery:
')
<script type="text/javascript">
jQuery(document).ready(function (){
var ee = jQuery('.same_column');
var div1 = jQuery(ee[0]).height();
var div2 = jQuery(ee[1]).height();
if(div1 > div2) {
jQuery(ee[1]).height(div1);
}
else {
jQuery(ee[0]).height(div2);
}
});
</script>


Everything worked perfectly in all browsers, but with further development a strange bug appeared in Safari:
If inside the block to which the script refers there is any image, then the safari is buggy.

Screenshots:
Mozilla screen
Mozilla

Screen Safari
Safari

Source: https://habr.com/ru/post/37300/


All Articles