Tuesday, 17 September 2013

How can I combine these jQuery .on() functions?

How can I combine these jQuery .on() functions?

Here is my code. The swipes are for anywhere in the document, the click is
for the close img, but they execute the same code. Any advice? It's not an
overly big deal, but I would like smaller, cleaner code if I can. This is
for a modal type window.
$(document).on("click", "#close", function () {
ttl.html(docTitle + air);
window.history.pushState({}, docTitle + air, docURL);
}).on("swipeleft swiperight", function () {
ttl.html(docTitle + air);
window.history.pushState({}, docTitle + air, docURL);
});

No comments:

Post a Comment