Actions

User

Canadabonk/spoiler.js: Difference between revisions

From Anthrodia Atlas

dev>Canadabonk
Created page with "$(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'); } }); });"
 
m 1 revision imported: Import even more templates
(No difference)

Revision as of 08:24, 27 June 2024

$(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');
		}
	});
	
});