有没有办法在jQuery中从listview按钮延迟/超时回发?我想在回发之前制作fadeOut动画,这是在点击按钮时触发。有什么想法吗?
我的代码:
$(document).ready(function () {
$('.btndown').click(function () {
$('.imageset').animate({ 'opacity': 0 }, 1000);
});
});
按钮标记,点击后会收到回发:
<div class="btndown">
<asp:DataPager ID="DataPager2" runat="server" PagedControlID="Listview1" PageSize="3">
<Fields>
<asp:NextPreviousPagerField ButtonType="Image" FirstPageText="" LastPageText="" NextPageImageUrl="~/images/arrowbtndown.png" NextPageText="" PreviousPageText="" ShowPreviousPageButton="False"/>
</Fields>
</asp:DataPager>
</div>
按钮输出:
<input type="image" name="ctl00$ContentPlaceHolder1$DataPager2$ctl00$ctl00" src="images/arrowbtndown.png">
答案 0 :(得分:1)
请勿使用超时,请使用animation complete callback。
// This stops the `postback` from being fired on the `<asp>` generated button.
$('.btndown input').click(function(e){
e.preventDefault();
});
$('.btndown').click(function (e) {
e.preventDefault();
$('.imageset').animate({
'opacity': 0
}, 1000, function() {
// Animation has completed
// Trigger the 'postback' JS function, whatever this may be.
});
});
取决于输出内容:
<asp:DataPager ID="DataPager2" runat="server" PagedControlID="Listview1" PageSize="3">
<Fields>
<asp:NextPreviousPagerField ButtonType="Image" FirstPageText="" LastPageText="" NextPageImageUrl="~/images/arrowbtndown.png" NextPageText="" PreviousPageText="" ShowPreviousPageButton="False"/>
</Fields>
</asp:DataPager>
会产生影响,因为此输出可以在点击时立即触发回发。如果你分享最终输出,它可能会有所帮助。
答案 1 :(得分:0)
修改强>
最终解决方案:
CLogger& operator<<(CLoggerEndl_t)
{
push_back(m_logLine);
m_logLine.logString.clear();
return *this;
}