javascript - Jquery how do i remove and add a class after button click with time delay before other functions -
i have script button click following html in turn brings content marked "target-data"
the tag .....
<a class='slide' href='#' data-url='who-are-musability-music-therapy.html' data-target='#music'> <span class='element'>music</span> </a> the data target gets loaded...
<div id ="overview" class="animated bounceinup"></div> and jquery performs on click ...
$(document).ready(function(){ $("body").on("click", ".slide", function(e){ e.preventdefault(); console.log($("#tam-content").load($(this).data("url") + ' ' + $(this).data("target"))); }); }); question :- how put timer in script 2 sec removes class bounceinup , adds bounceoutup goes link normal ?
hard say, maybe looking for:
$(function(){ $('.slide').click(function(){ var t = $(this), tc = $('#tam-content'); tc.load(t.data('url')+' '+t.data('target'), function(){ settimeout(function(){ var = tc.find('.animated'); if(a.hasclass('bounceinup')){ a.removeclass('bounceinup').addclass('bounceoutup'); } else if(a.hasclass('bounceoutup')){ a.removeclass('bounceoutup').addclass('bounceinup'); } // run other code here }, 2000); }); }); });
Comments
Post a Comment