document.addEventListener('DOMContentLoaded', function () {
if (window.innerWidth < 767) {
document.querySelector('.heading').classList.remove('gsap-reveal-hero');
} else {
document.querySelector('.heading').classList.add('gsap-reveal-hero');
}
});
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p class="gsap-reveal-hero heading">1</p>
<p class="gsap-reveal-hero heading">2</p>
<p class="gsap-reveal-hero heading">3</p>
<p class="gsap-reveal-hero heading">4</p>
</body>
<style>
.gsap-reveal-hero{
color: blueviolet;
}
</style>
<script>
let heading = Array.from(document.querySelectorAll('.heading'))
document.addEventListener('DOMContentLoaded', function () {
heading.forEach(function(item){
if (window.innerWidth < 767) {
item.classList.remove('gsap-reveal-hero');
} else {
item.classList.add('gsap-reveal-hero');
}
})
});
</script>
</html>