How jQuery Works in WordPress

hy all, I have streaming site, and want to make a toggle button to switch to Dark/light mode using jQuery. please look to my code, what is wrong with my code, bcz this is not work for me.

in footer.php (above )

<div class=”gelap-terang”></div>
<script>
jQuery.noConflict();

jQuery(document).ready(function(){
jQuery(“.gelap-terang”).hide();

jQuery(“#gelap-terang”).click(function(){
jQuery(“.gelap-terang”).toggle();
});
});
</script>

in player.php


<div class=”player_nav”>
<button id=”gelap-terang”>Change Mode</button>
</div>

CSS code

.gelap-terang {
height:100%;
width:100%;
background-color:black;
opacity:.8;
position:fixed;
top:0;left:0;
z-index:1;display:none;}

#player2, .player_nav {
z-index:99;
position:relative;}

the button is perfect look in the below of player video, but the is not appear when I click the button. I tried to delete the “display:none;” in the .gelap-terang CSS code, the is appear and look good, but not switch (hide) when I click the button.

Read more here:: How jQuery Works in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *