Loading js scripts by check page inside js file
-
Hi https://wordpress.org/support/profile/bethannon1
i have a myscrits.js file in which i call all the scripts api.
Need some help how can i check the current template in js file so that below code executes only at that time// DOM Ready $(function() { //some code is here // the below code i want this is execute only for home page only // as i enqueued files related to below script in proper // condition in functions.php var button = document.getElementById('cn-button'), wrapper = document.getElementById('cn-wrapper'); //open and close menu when the button is clicked var open = false; button.addEventListener('click', handler, false); function handler(){ if(open){ this.innerHTML = "<div class='logo '></div>"; classie.add(wrapper, 'opened-nav'); } else{ this.innerHTML = " <div class='logo'></div>"; classie.remove(wrapper, 'opened-nav'); } open = !open; } function closeWrapper(){ classie.remove(wrapper, 'opened-nav'); } }); }); }); // some other code is also here
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Loading js scripts by check page inside js file’ is closed to new replies.