Actions

User

Canadabonk/spoiler.js: Difference between revisions

From Anthrodia Atlas

m 1 revision imported: Import even more templates
m 2 revisions imported
 
(No difference)

Latest revision as of 04:09, 27 May 2026

$(document).ready(function(){

    $('#spoilerbtn').text('Show all spoilers');
	
    //spoiler block behavior
	$('.spoiler').click(function(){
		$(this).toggleClass('off');
	});

	// spoiler button behavior
	$('#spoilerbtn').click(function(){
		$(this).toggleClass('hide');
		$('.spoiler').toggleClass('showall');
		
		if (this.classList.contains('hide')){
			$(this).text('Hide all spoilers');
		} else {
			$(this).text('Show all spoilers');
		}
	});
	
});