javascript - How to toggle jQuery element with a duration AND display? -
when want toggle off component can use
$("#donkey").toggle(false);
and when need toggled during time period can use
$("#emailinvalid").toggle(700);
but i'd combine two. want ensure component being toggled off (not toggled , forth) , want specify duration of process.
according jquery api, i'm supposed able specify object options, too. however, following
$("#donkey").toggle({ duration: 700, display: false });
only toggles donkey , forth (during said time, though), whereas i'd toggled invisibility. when reviewed options, noticed there's none addresses display, fear above treated jquery equivalently with
$("#donkey").toggle({ duration: 700, biteme: "in donkey" });
how can make sure toggler hiding component (equivalent first line of code above) and can control time process done (equivalent second line of code above)?
short answer - can't.
your options build custom , carry out logic in custom code. alernatively, might want toggle between differen classes have like. check out toggleass() details.
for completeness give link animate() suggested @davidthomas, although haven't used 1 much.
Comments
Post a Comment