Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevShahidul/e99c815b9641b1ee3201d019dc5798e3 to your computer and use it in GitHub Desktop.
Save DevShahidul/e99c815b9641b1ee3201d019dc5798e3 to your computer and use it in GitHub Desktop.
// This is One way
var delayTime = 0.3
$('.nav-wrap ul li').each(function(a){
var thisDelay = delayTime * a
thisDelay = thisDelay + "s"
$(this).css({
"transition-delay" : thisDelay,
//"opacity" : 1
})
})
// This is another way
var delayTime = 0.3
$('.nav-wrap ul li').each(function(i){
$(this).css({
"transition-delay" : delayTime *i+ "s",
})
})
// Another way with reverse
$("#main-nav-wrap .main-nav li").each(function(i){
var delayCounter = i+1
$(this).css({
"transition-delay" : 150*delayCounter+"ms"
})
})
var totalElmntCount = $(".main-nav li").length
$("#main-nav-wrap.navActive .main-nav li").each(function(i){
var delayCounter = 150*(totalElmntCount-(i+1))
$(this).css({
"transition-delay" : delayCounter+"ms"
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment