asp.net - Way to delay/timeout postback in jQuery? -


is there way delay/timeout postback listview button in jquery? make fadeout animation before postback, firing when button clicked. ideas?

my code:

$(document).ready(function () {     $('.btndown').click(function () {         $('.imageset').animate({ 'opacity': 0 }, 1000);     }); }); 

button markup, getting postback when it's clicked:

<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> 

button output:

<input type="image" name="ctl00$contentplaceholder1$datapager2$ctl00$ctl00" src="images/arrowbtndown.png"> 

don't use timeout, use animation complete callback.

// stops `postback` being fired on `<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 'postback' js function, whatever may be.     }); }); 

depending on outputs:

<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> 

will make difference outputs trigger postback right away on click. if share final output might more.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -