Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95162760
toggleClass.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Dec 13, 08:54
Size
462 B
Mime Type
text/x-java
Expires
Sun, Dec 15, 08:54 (1 d, 6 h)
Engine
blob
Format
Raw Data
Handle
22919400
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
toggleClass.js
View Options
import
addClass
from
'./addClass'
;
import
hasClass
from
'./hasClass'
;
import
removeClass
from
'./removeClass'
;
/**
* Toggles a CSS class on a given element.
*
* @param element the element
* @param className the CSS class name
*/
export
default
function
toggleClass
(
element
,
className
)
{
if
(
element
.
classList
)
element
.
classList
.
toggle
(
className
);
else
if
(
hasClass
(
element
,
className
))
removeClass
(
element
,
className
);
else
addClass
(
element
,
className
);
}
Event Timeline
Log In to Comment