1
有任何jquery,它是父類div後的find類,我使用的類「梯形二」,並使jquery代碼,但創建問題,所以可以任何一個電話我如何找到後css父級div類('ban-menu1')。查找父類div後的css類
HTML: -
<div class="col-md-2 nopadding">
<div class="ban-menu1"></div>
<svg class="trapezoid-two" viewbox="0 0 100 100" preserveAspectRatio="none" width="100%">
<defs>
<pattern id="img1" patternUnits="userSpaceOnUse" width="100" height="100">
<image xlink:href="images/shade-two.jpg" x="0" y="0" width="110" height="100" />
</pattern>
</defs>
<path d="M0,0 L100,23 L100,77 L0,100z" fill="url(#img1)"></path>
</svg>
</div>
jQuery的
$(document).ready(function(){
$(".trapezoid-two").hover(
function() {
$(this).find('path').attr('d','M0,0 L100,0 L100,100 L0,100z');
$(this).parent().addClass('img-scale');
}, function() {
$(this).find('path').attr('d','M0,0 L100,23 L100,80 L0,100z');
$(this).parent().removeClass('img-scale');
}
);
});
no「col-md-2 nopadding」是父母,我必須找到「ban-menu1」班或div –
@BharatNegi在下面看到我的回答 – madalinivascu