0

嗨,我想用下面的“高级链接”类获取 a href 标记内图像的高度

<div id="gallery" class="content" style="display: block;">
  <div class="slideshow-container">
    <div id="slideshow" class="slideshow">
      <span class="image-wrapper current" style="opacity: 1;">
        <a class="advance-link" title="undefined" href="#2" rel="history">
          <img alt="undefined" src="images/experiments/large/experiments.jpg">
        </a>
      </span>
    </div>
  </div>
</div>

请帮忙

4

1 回答 1

2

最简单的,我建议:

$('a.advance-link img').height();

这应该放在 a$(window).load()中,而不是$(document).ready(),因为load()等待图像加载,而ready()只是等待 DOM 构建并准备好:

$(window).load(
    function(){
        var heightOfImage = $('a.advance-link img').height();
    });

参考:

于 2012-08-03T22:04:54.247 回答