I want to get img height

Asked 1 years ago, Updated 1 years ago, 37 views

I want to get the height of the element (variable) whose height of html is not fixed, but I don't know how to get it.
I used the link below to create a slide show.
https://allabout.co.jp/gm/gc/417216/
At present, other elements will be underneath the slide show.
I would appreciate it if you could let me know

function slideSwitch(){
  var$active=$('#slideshowimg.active');

  if($active.length==0)$active=$('#slideshowimg:last');

  var$next=$active.next().length?$active.next()
    : $('#slideshow img:first');

  $active.addClass('last-active');

  $next.css ({opacity:0.0})
    .addClass('active')
    .animate({opacity:1.0},1000,function(){
      $active.removeClass('active last-active');
    });
}

$(function(){
  setInterval("slideSwitch(), 3000);
});
.container{
  width: 100%;
  margin:0 auto;
}


#slideshow{
  margin —auto;
  vertical-align:middle;
  position:relative;
  top:0;
}

#slideshow img {
  width: 100%;
  position:absolute;
  top:0;
  left:0;
  z-index:9;
  opacity: 0.0;
}

# slideshow img.active {
  z-index:10;
  opacity: 1.0;
}

# slideshow img.last-active {
  z-index:9;
}

/*----------------------------------------------
.top-bk-img{
  background-image: url("../images/webbase03-04-0609.png");
  background-size:cover;
  padding-bottom —5%;
}
<divid="top" class="container">
  <divid="slideshow">
  <img src="images/web-base01.png" alt="Image 1" class="active">
  <img src="images/web-base02.png" alt="Image 2">
</div>
</div>

<div class="top-bk-img"></div> 

javascript html css

2022-09-30 16:39

1 Answers

I was able to get it when I loaded the page with element.style.height.
Resolved.


2022-09-30 16:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.