javascript - Jquery how do i perform a class change function before the next click -


i have bit of script data , puts in class called .tile-area-main

i need able know how delay entire click introduce new class animation run seconds before moving on new click.... how go ? ...

(i sure timeout add class kinda have been researching)

the script in question

$(document).ready(function() {     $("body").on("click", ".slide", function(e) {         e.preventdefault();         var url = $(this).attr('data-url') + ' #' + $(this).attr('data-target');         $('.tile-area-main').load(url);     }); }); 

you need use settimeout

calls function or executes code snippet after specified delay.

code

$("body").on("click", ".slide", function(e) {   e.preventdefault();    //remove , add required classs   $(yourelement).removeclass('a').addclass('b');    //delay execution of load   settimeout(function(){     var url = $(this).attr('data-url') + ' #' + $(this).attr('data-target');     $('.tile-area-main').load(url);   }, 1000); //time interval in milliseconds  }); 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -