jq-crossword
by Haztivity
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdn.rawgit.com/davinchi-finsi/crossword-definition/c18ff563/dist/crossword-definition.min.js"></script>
<script src="https://cdn.rawgit.com/davinchi-finsi/jq-crossword/8d47213a/dist/jquery.crossword.min.js"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/davinchi-finsi/jq-crossword/8d47213a/dist/crossword.structure.css">
<link rel="stylesheet" href="https://cdn.rawgit.com/davinchi-finsi/jq-crossword/8d47213a/dist/crossword.theme-default.css">
<div class="crossword"></div>
JavaScript
const {
CrosswordDefinition
} = crosswordDefinition;
let definition = new CrosswordDefinition({
height: 8, //height of the board, 8 cells
width: 5, //width of the board, 5 cells
acrossClues: [{
number: 1, //number to identify the world, must be unique
x: 1, //The x position where the word starts, starting from 1
y: 2, //The y position where the word starts, starting from 1
answer: "Hello", //the word itself
clue: "A common greeting", //the clue
hints: [2], //the letter 'e' is a hint. Starting from 1
},
{
number: 2,
x: 3,
y: 5,
answer: "Old",
clue: "Having lived for a long time; no longer young."
}
],
downClues: [{
number: 1,
x: 1,
y: 2,
answer: "History",
clue: "The study of past events, particularly in human affairs.",
hints: [2, 7]
},
{
number: 3,
x: 5,
y: 1,
answer: "World",
clue: "The earth is our _____"
}
]
});
$(".crossword").crossword({
definition: definition
});