jQuery在调整大小

时间:2015-10-15 20:58:14

标签: jquery resize each

无法获取当前高度并调整宽度,然后将新高度设置为8px。由于调整大小,它需要8px值,然后将高度重置为新的8px值。请帮忙。

$(window).resize(function() {

    if (Modernizr.mq('(max-width: 775px)')){
        $(".scores li a > div").each(function(index, value){
            var scoreHeight = $(this).height();
            $(this).width(scoreHeight);
            $(this).height("8px");
        });

    }
});
<ul>
<li class="self-awareness active">
    <a href="#self-awareness">
        <span>Self Awareness</span><span class="score"> - 400</span>
        <div style="height: 400px;">
            <div class="image"></div>
        </div>
    </a>
</li>
<li class="values">
    <a href="#values">
        <span>Values</span><span class="score"> - 348</span>
        <div style="height: 348px;">
            <div class="image"></div>
        </div>
    </a>
</li>
<li class="integrated-life">
    <a href="#integrated-life">
        <span>Integrated Life</span><span class="score"> - 208</span>
        <div style="height: 208px;">
            <div class="image"></div>
        </div>
    </a>
</li>

0 个答案:

没有答案