I am trying to modify html's style when one of several classes is clicked on by .click()
function, but I would like not to write one function for each class. Is there any way to put every class as selectors in the same function? And if there is, how would be the sintax?
Here is the piece of my code:
$(".back").click(function(){
console.log("widget closed");
if( !$("body").hasClass('widget-opened')){
$("html").css("overflow-y","auto");
}
});
In addition to .back
, it would be nice to call two more classes (.laptop
and .close
)