我试图在按钮位于类页脚时找到位于类前面的 a 的 href 属性。似乎无法让它工作。
HTML
<div class="panel">
<div class="front">
<a rel="lightbox" href="asas/as/abc.html">
<img width="200" height="125" src="http://www.wired.com/wiredenterprise/wp-content/uploads//2012/10/stormtroopers-sm.png" >
</a>
<div class="footer">
<button class="btn btn-mini" rel="btn_scr"><i class="icon-fullscreen"></i> </button>
</div>
</div>
<div class="back" style="width: 200px; height: 157px;">something here</div>
</div>
JAVA
$('body').on('click', '[rel=btn_scr]', function (event) {
event.preventDefault();
var data = $(this).parents(".front > a").attr("href");
alert(data);
//console.log(data);
});