Tri*_*eft 1 css jquery selector
我正在编写一个简单的脚本来替换两个图像.第一个交换正常,但第二个由于某种原因不会开火.它必须是我想念的简单事物.也许'div.singleTint img'选择器?有人可以看看并仔细检查我的工作吗?
这是我的HTML:
<div id="beerGlassOverlay">
<img src="<?php bloginfo('template_directory'); ?>/images/beerOverlay.png" class="glassreplace">
</div>
<li class="image-rollover">
<a href="http://brasco.co/Mims/meet-the-breweries/miller-beers/" target="_blank">
<img width="177" height="186" src="http://brasco.co/Mims/wp-content/uploads/2012/05/miller1.png" class="attachment-full wp-post-image" alt="miller" title="miller" />
</a>
<div class="singleTint">
<img width="279" height="524" src="http://brasco.co/Mims/wp-content/uploads/shrekBeer.png" class="attachment-full" alt="shrekBeer" title="shrekBeer" />
</div><!-- End singleTint-->
</li>
Run Code Online (Sandbox Code Playgroud)
这是我的jQuery:
$('li.image-rollover').mouseover(function() {
$('img.glassreplace').attr({//Change the src and size info on hover
src: ('div.singleTint img', this).src,
width: '100%',
height: '100%'
});
});`
Run Code Online (Sandbox Code Playgroud)
改变这个:
src: ('div.singleTint img', this).src,
Run Code Online (Sandbox Code Playgroud)
至:
src: $('div.singleTint img', this).attr('src'),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
160 次 |
| 最近记录: |