Support
Quality
Security
License
Reuse
kandi has reviewed lucida and discovered the below as its top functions. This is intended to give you an instant insight into lucida implemented functionality, and help decide if they suit your requirements.
lucida: back-end services and command center (CMD). Currently, there are 7 categories of back-end services: "ASR" (automatic speech recognition), "IMM" (image matching), "QA" (question answering), "CA" (calendar events retrieval), "IMC" (image classification), "FACE" (facial recognition), and "DIG" (digit recognition). You can delete or replace these services with your own, or you can simply add a new service. For example, if you know some better ASR implementation, have an interesting image captioning end-to-end system, or have access to a quality machine translation algorithm, please read the section "How to Add Your Own Service into Lucida?" below. The command center determines which services are needed based on the user input, sends requests to them, and returns response to the user. In the following diagram, the user asks a query that needs the following three services: ASR, IMM, and QA. The "cloud" behind each box means the Docker container(s) running on the host machine(s).
tools: dependencies necessary for compiling Lucida. Due to the fact that services share some common dependencies, all services should be compiled after these dependencies are installed. The advantage of a central point of dependencies is that the total size of compiled services is minimized; the disadvantage is that it makes deleting a service from Lucida non-trivial -- you have to remove its dependencies in tools.
Lucida Local Development
export LD_LIBRARY_PATH=/usr/local/lib
Detailed Instructions
include "lucidatypes.thrift"
service LucidaService {
void create(1:string LUCID, 2:lucidatypes.QuerySpec spec);
void learn(1:string LUCID, 2:lucidatypes.QuerySpec knowledge);
string infer(1:string LUCID, 2:lucidatypes.QuerySpec query);
}
My dynamically generated text is appearing vertically - JS, CSS, HTML
dog = new item("dog", 10, 1, 1, "button.png");
cat = new item("cat", 5, 1, 1, "button.png");
horse = new item("horse", 2, 1, 1, "button.png");
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
dog = new item("dog", 10, 1, 1, "button.png");
cat = new item("cat", 5, 1, 1, "button.png");
horse = new item("horse", 2, 1, 1, "button.png");
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
dog = new item("dog", 10, 1, 1, "button.png");
cat = new item("cat", 5, 1, 1, "button.png");
horse = new item("horse", 2, 1, 1, "button.png");
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
dog = new item("dog", 10, 1, 1, "button.png");
cat = new item("cat", 5, 1, 1, "button.png");
horse = new item("horse", 2, 1, 1, "button.png");
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
dog = new item("dog", 10, 1, 1, "button.png");
cat = new item("cat", 5, 1, 1, "button.png");
horse = new item("horse", 2, 1, 1, "button.png");
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
.banner > *{
display: flex;
flex-direction: row;
justify-content: center;
}
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
cat = new item("cat", 5, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
horse = new item("horse", 2, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
display: flex;
flex-direction: row;
justify-content: center;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
.banner > *{
display: flex;
flex-direction: row;
justify-content: center;
}
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
cat = new item("cat", 5, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
horse = new item("horse", 2, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
display: flex;
flex-direction: row;
justify-content: center;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
.banner > *{
display: flex;
flex-direction: row;
justify-content: center;
}
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
cat = new item("cat", 5, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
horse = new item("horse", 2, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
display: flex;
flex-direction: row;
justify-content: center;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
-----------------------
.banner > *{
display: flex;
flex-direction: row;
justify-content: center;
}
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
cat = new item("cat", 5, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
horse = new item("horse", 2, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
display: flex;
flex-direction: row;
justify-content: center;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
Shading cells of a grid of "pixels" using javascript
const container = document.querySelector('.gridContainer');
const startButton = document.querySelector('.gridCreator');
function createGrid(rows = 16, columns = 16) { // Creates default grid of 16x16 on page load
total = rows * columns;
for (i = 0; i < total; i++) {
cells = document.createElement('div');
cells.classList.add('cell');
cells.setAttribute('style', 'margin: 0; padding: 0; background-color: black; opacity: 0;')
//cellsToBeShaded = document.querySelectorAll('.cell');
container.style.gridTemplateColumns = `repeat(${columns}, 1fr)`;
container.style.gridTemplateRows = `repeat(${rows}, 1fr)`;
container.appendChild(cells);
}
shadeCells();
}
createGrid();
function newGrid(layout) { // Prompts user for input between 2 and 100 to create new grid of a different size
const cellCount = document.querySelectorAll('.cell');
for (i = 0; i < cellCount.length; i++) {
container.removeChild(cellCount[i]);
}
do {
layout = parseInt(prompt('How many columns and rows would you like to play? Pick between 12 and 100!'));
gridSize = layout * layout;
} while ((layout < 2 && Number) || (layout > 100 && Number));
createGrid(layout, layout);
}
function shadeCells() { // Shades grid cells on mouseover
const cells = document.querySelectorAll('.cell');
cells.forEach(cell => {
cell.addEventListener('mouseover', () => {
//cell.style.backgroundColor = '#000';
if (cell.style.opacity >= 0.1) {
cell.style.opacity = Number(cell.style.opacity) + 0.1; // <-- HERE
} else {
cell.style.opacity = 0.1;
}
})
})
}
startButton.addEventListener('click', newGrid);
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
}
#header {
display: flex;
flex-direction: row;
justify-content: center;
gap: 3%;
}
.headerText {
font-size: 40px;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
button {
height: 50%;
width: 7%;
margin: 0%;
align-self: flex-end;
border-radius: 10px;
border: solid black 1px;
box-shadow: 3px 3px;
}
.gridContainer {
margin: auto;
height: 600px;
width: 600px;
border: solid black 1px;
display: grid;
grid-template-columns: repeat(auto, 1fr);
}
<div id="header">
<div class="headerText">Etch-A-Sketch</div>
<button class="gridCreator">Create Grid</button>
</div>
<div class="gridContainer"></div>
-----------------------
const container = document.querySelector('.gridContainer');
const startButton = document.querySelector('.gridCreator');
function createGrid(rows = 16, columns = 16) { // Creates default grid of 16x16 on page load
total = rows * columns;
for (i = 0; i < total; i++) {
cells = document.createElement('div');
cells.classList.add('cell');
cells.setAttribute('style', 'margin: 0; padding: 0; background-color: black; opacity: 0;')
//cellsToBeShaded = document.querySelectorAll('.cell');
container.style.gridTemplateColumns = `repeat(${columns}, 1fr)`;
container.style.gridTemplateRows = `repeat(${rows}, 1fr)`;
container.appendChild(cells);
}
shadeCells();
}
createGrid();
function newGrid(layout) { // Prompts user for input between 2 and 100 to create new grid of a different size
const cellCount = document.querySelectorAll('.cell');
for (i = 0; i < cellCount.length; i++) {
container.removeChild(cellCount[i]);
}
do {
layout = parseInt(prompt('How many columns and rows would you like to play? Pick between 12 and 100!'));
gridSize = layout * layout;
} while ((layout < 2 && Number) || (layout > 100 && Number));
createGrid(layout, layout);
}
function shadeCells() { // Shades grid cells on mouseover
const cells = document.querySelectorAll('.cell');
cells.forEach(cell => {
cell.addEventListener('mouseover', () => {
//cell.style.backgroundColor = '#000';
if (cell.style.opacity >= 0.1) {
cell.style.opacity = Number(cell.style.opacity) + 0.1; // <-- HERE
} else {
cell.style.opacity = 0.1;
}
})
})
}
startButton.addEventListener('click', newGrid);
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
}
#header {
display: flex;
flex-direction: row;
justify-content: center;
gap: 3%;
}
.headerText {
font-size: 40px;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
button {
height: 50%;
width: 7%;
margin: 0%;
align-self: flex-end;
border-radius: 10px;
border: solid black 1px;
box-shadow: 3px 3px;
}
.gridContainer {
margin: auto;
height: 600px;
width: 600px;
border: solid black 1px;
display: grid;
grid-template-columns: repeat(auto, 1fr);
}
<div id="header">
<div class="headerText">Etch-A-Sketch</div>
<button class="gridCreator">Create Grid</button>
</div>
<div class="gridContainer"></div>
-----------------------
const container = document.querySelector('.gridContainer');
const startButton = document.querySelector('.gridCreator');
function createGrid(rows = 16, columns = 16) { // Creates default grid of 16x16 on page load
total = rows * columns;
for (i = 0; i < total; i++) {
cells = document.createElement('div');
cells.classList.add('cell');
cells.setAttribute('style', 'margin: 0; padding: 0; background-color: black; opacity: 0;')
//cellsToBeShaded = document.querySelectorAll('.cell');
container.style.gridTemplateColumns = `repeat(${columns}, 1fr)`;
container.style.gridTemplateRows = `repeat(${rows}, 1fr)`;
container.appendChild(cells);
}
shadeCells();
}
createGrid();
function newGrid(layout) { // Prompts user for input between 2 and 100 to create new grid of a different size
const cellCount = document.querySelectorAll('.cell');
for (i = 0; i < cellCount.length; i++) {
container.removeChild(cellCount[i]);
}
do {
layout = parseInt(prompt('How many columns and rows would you like to play? Pick between 12 and 100!'));
gridSize = layout * layout;
} while ((layout < 2 && Number) || (layout > 100 && Number));
createGrid(layout, layout);
}
function shadeCells() { // Shades grid cells on mouseover
const cells = document.querySelectorAll('.cell');
cells.forEach(cell => {
cell.addEventListener('mouseover', () => {
//cell.style.backgroundColor = '#000';
if (cell.style.opacity >= 0.1) {
cell.style.opacity = Number(cell.style.opacity) + 0.1; // <-- HERE
} else {
cell.style.opacity = 0.1;
}
})
})
}
startButton.addEventListener('click', newGrid);
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
}
#header {
display: flex;
flex-direction: row;
justify-content: center;
gap: 3%;
}
.headerText {
font-size: 40px;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
button {
height: 50%;
width: 7%;
margin: 0%;
align-self: flex-end;
border-radius: 10px;
border: solid black 1px;
box-shadow: 3px 3px;
}
.gridContainer {
margin: auto;
height: 600px;
width: 600px;
border: solid black 1px;
display: grid;
grid-template-columns: repeat(auto, 1fr);
}
<div id="header">
<div class="headerText">Etch-A-Sketch</div>
<button class="gridCreator">Create Grid</button>
</div>
<div class="gridContainer"></div>
CSS, HTML - Color change of HR element by button:active
button.nav-buttons:active~#hr-nav { border-color: red; }
-----------------------
button.nav-buttons {
width: 130px;
border: 0.5px solid;
xxx_background-color: transparent;
border-color: transparent;
border-radius: 3px;
font-family: "Lucida Console", "Courier New", monospace;
color: white;
font-weight: 600;
font-size: 20px;}
button.nav-buttons:hover {
border-color: white;}
button.nav-buttons:active {
color: red;
border: 1px solid red;}
button.nav-buttons:active + hr { border-color: red;}
#hr-nav {
width: 80%;
margin: auto;
border: 1px solid white;}
<div class="wrapper">
<div class="parent">
<button class="nav-buttons">x</button>
<hr/>
</div>
<div class="parent">
<button class="nav-buttons">x</button>
<hr/>
</div>
</div>
-----------------------
button.nav-buttons {
width: 130px;
border: 0.5px solid;
xxx_background-color: transparent;
border-color: transparent;
border-radius: 3px;
font-family: "Lucida Console", "Courier New", monospace;
color: white;
font-weight: 600;
font-size: 20px;}
button.nav-buttons:hover {
border-color: white;}
button.nav-buttons:active {
color: red;
border: 1px solid red;}
button.nav-buttons:active + hr { border-color: red;}
#hr-nav {
width: 80%;
margin: auto;
border: 1px solid white;}
<div class="wrapper">
<div class="parent">
<button class="nav-buttons">x</button>
<hr/>
</div>
<div class="parent">
<button class="nav-buttons">x</button>
<hr/>
</div>
</div>
-----------------------
<!DOCTYPE html>
<html>
<head>
<style>
#nav-bar-outer { width: 100%; }
#nav-bar { margin: auto; width: 55%;}
a.nav-buttons {
width: 500px;
border: 1px solid;
margin: 2px 20px;
padding: 0px 25px;
background-color: transparent;
border-color: transparent;
border-radius: 3px;
font-family: "Lucida Console", "Courier New", monospace;
color: black;
font-weight: 600;
font-size: 20px;
text-decoration: none; }
a.nav-buttons:hover { border-color: white; }
a.nav-buttons:active { border-color: red; color: red; }
a.nav-buttons:active~#hr-nav { border-color: red; }
</style>
</head>
<body>
<div id="nav-bar-outer"><div id="nav-bar"><center>
<a class="nav-buttons" href="">1</a>
<a class="nav-buttons" href="">2</a>
<a class="nav-buttons" href="">3</a>
<a class="nav-buttons" href="">4</a>
<hr id="hr-nav"></center>
</body>
</html>
Active nav link is not shown at the correct section because of header offset
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
</section>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
<!-- div should be nested within section to not throw off anchor -->
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
const sections = document.querySelectorAll("section");
const navLi = document.querySelectorAll(".nav li");
window.addEventListener("scroll", () => {
let current = "";
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= sectionTop - sectionHeight / 3) {
current = section.getAttribute("id");
}
});
navLi.forEach((li) => {
li.classList.remove("active-link");
if (li.classList.contains(current)) {
li.classList.add("active-link");
}
});
});
/*Menu Toggle*/
$(".menu-toggle").click(function() {
$(".nav").toggleClass("nav--open", 500);
$(".overlay").toggleClass("showOverlay");
$(this).toggleClass("open");
});
$(".overlay").click(function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
$(".nav a").on("click", function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
/*Smooth Scrolling*/
// Get the height of the header for offsetting
var headerHeight = $(".header-container").height();
// Attach the click event
$('.nav-link').bind("click", function(e) {
var target = $(this).attr("href"); //Get the target
var scrollToPosition = $(target).offset().top - headerHeight;
$('html').animate({
'scrollTop': scrollToPosition
}, 900, function(target) {
window.location.hash = target;
});
e.preventDefault();
});
<!--Back To Top Script-->
window.addEventListener('scroll', function() {
var scroll = document.querySelector('.scrollTop');
scroll.classList.toggle("active", window.scrollY > 500)
})
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
/*My Special Menu*/
html {
overflow-x: hidden;
}
.header-container {
background: -webkit-linear-gradient(left, #7abff6 0%, #03a9f4 100%);
color: #fff;
width: 100%;
position: fixed;
top: 0;
z-index: 999;
}
.container {
/*width: 95%;
max-width: 1000px;
*/
width: 90%;
max-width: 1600px;
height: 84.4px;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.logo__text {
text-transform: uppercase;
font-weight: 700;
font-size: 30px;
padding: 18px;
}
.logo__text span {
font-weight: 400;
margin-left: 6px;
}
.logo__text1 {
font-size: 13px;
padding-left: 220px;
}
.logo__text1 h3 {
font-weight: 300;
}
/*a.nav-link.availability-button {
color: #ffffff !important;
border-width: 0px !important;
letter-spacing: 1.5px;
font-size: 14px;
font-weight: 700 !important;
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}
a.nav-link.availability-button:hover {
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}*/
.nav a.active {
color: #fff;
}
.nav {
position: absolute;
background: #fff;
-webkit-clip-path: circle(0px at top right);
clip-path: circle(0px at top right);
transition: -webkit-clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms, -webkit-clip-path ease-in-out 700ms;
}
.nav--open {
-webkit-clip-path: circle(250% at top right);
clip-path: circle(250% at top right);
}
.nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
border-bottom: 1px solid #575766;
border-left: 1px solid #575766;
border-right: 1px solid #575766;
}
.nav li:last-child {
border-bottom: none;
}
@media screen and (max-width: 1240px) {
/*.nav li:last-child {
display: none;
}*/
}
@media screen and (min-width: 1200px) {
.check-button {
display: none !important;
}
}
.nav-link {
color: #000;
font-size: 14px;
display: block;
padding: 2em 4em 2em 1.5em;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
outline: none;
}
/*.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}*/
.nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
/*color: #000;*/
}
i.fas.fa-home.nav--icon {
color: #552401;
}
i.far.fa-image.nav--icon {
color: #9a57d8;
}
i.fas.fa-bed.nav--icon {
color: #ef991f;
}
i.far.fa-thumbs-up.nav--icon {
color: #5912d0;
}
i.fas.fa-sun.nav--icon {
color: #f2da08;
}
i.fas.fa-envelope.nav--icon {
color: #0a2fa0;
}
.menu-toggle {
padding: 1em;
padding-right: 50px;
position: absolute;
top: 1em;
right: -25px;
cursor: pointer;
z-index: 3;
}
@media only screen and (min-width: 480px) {
.menu-toggle {
top: 1.6em;
}
}
@media only screen and (max-width: 479px) {
.container {
height: 70px;
}
.menu-toggle {
top: 1.2em;
}
.nav {
top: 70px !important;
}
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: "";
display: block;
background: #fff;
height: 3px;
width: 1.75em;
border-radius: 3px;
-webkit-transition: all ease-in-out 500ms;
-o-transition: all ease-in-out 500ms;
transition: all ease-in-out 500ms;
}
.hamburger::before {
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.hamburger::after {
-webkit-transform: translateY(3px);
-ms-transform: translateY(3px);
transform: translateY(3px);
}
.open .hamburger {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
-webkit-transform: translateY(-3px) rotate(-90deg);
-ms-transform: translateY(-3px) rotate(-90deg);
transform: translateY(-3px) rotate(-90deg);
}
@media only screen and (max-width: 982px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}
}
@media only screen and (max-width: 602px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (max-width: 480px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (min-width: 983px) {
.menu-toggle {
display: none;
}
.nav {
height: auto;
position: relative;
background: transparent;
clip-path: initial;
-webkit-clip-path: initial;
}
.nav li {
display: inline-block;
border: none;
}
.nav a {
padding: 0.5em;
/*margin-left: 1em;*/
color: #fff;
}
.nav-item {
position: relative;
}
.nav-item:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: #edbb5f;
transition: all 0.5s ease-in-out;
z-index: -1;
}
.nav-item:hover:before {
width: 100%;
}
nav ul li.active-link {
background: #edbb5f;
}
/*.nav a:hover,
.nav a:focus {
background: #edbb5f;
padding: 7px;
}*/
.nav--icon {
display: none !important;
}
}
@media only screen and (max-width: 480px) {
.nav a {
padding: 1.3em 2.5em 1.3em 1em;
}
.logo__text {
padding: 18px 18px 18px 0;
font-size: 22px;
margin-left: 0;
}
.container {
max-width: 480px;
}
}
@media only screen and (max-width: 361px) {
.logo__text {
font-size: 20px;
}
.logo__text1 {
font-size: 10px;
}
}
/*End My Special Menu*/
.section-header-area {
background: url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/villa-blueview-bg02.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding: 30px 10px;
}
@media only screen and (max-width: 767px) {
.section-header-area {}
}
.section-header {
text-align: center;
}
.section-header h2 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 44px;
color: #565656 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
.section-header h2 {
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent;
background: -webkit-linear-gradient(left, #1e83ec 0%, #f6653c 100%);
}
strong {
font-weight: 700;
}
.section-header h3 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 1.6vw;
color: #767676 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
@media only screen and (max-width: 980px) {
.section-header h2 {
font-size: 44px;
}
.section-header h3 {
font-size: 26px;
}
}
@media only screen and (max-width: 767px) {
.section-header h2 {
font-size: 34px;
}
.section-header h3 {
font-size: 16px;
}
}
@media only screen and (max-width: 620px) {
.section-header h2 {
font-size: 28px;
}
}
/*Back To Top*/
.scrollTop {
position: fixed;
bottom: 800px;
right: 23px;
width: 50px;
height: 50px;
background: #399cf1 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
border-radius: 50%;
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
z-index: 10;
visibility: hidden;
opacity: 0;
transition: 0.5s;
}
.scrollTop.active {
bottom: 100px;
visibility: visible;
opacity: 1;
}
.scrollTop:hover {
background: #66b5f8 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
}
.overlay {
position: fixed;
display: none;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0);
width: 100%;
height: 100vh;
z-index: 2;
}
.showOverlay {
display: block;
}
@media only screen and (min-width: 983px) {
/*to stop overlay coming into screen on desktop when clicked on menu links otherwise it brings overlay layer on top of sections then it needs to be clicked on to make it dissappear */
.showOverlay {
display: none;
}
}
.hero-area {
height: 800px;
background-color: blanchedalmond;
}
.info-blurbs {
height: 800px;
background-color: red;
}
.container-grid-masonry {
height: 700px;
background-color: yellow;
}
.container-rooms {
height: 700px;
background-color: green;
}
.container-reviews {
height: 700px;
background-color: pink;
}
.container-activities {
height: 700px;
background-color: #ddd;
}
.container-contact {
height: 1200px;
background-color: lightblue;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="scrollTop" onclick="scrollToTop();"></div>
<div class="header-container">
<div class="container">
<div class="logo__text">Vİlla<span>Mavİ Manzara</span>
<div class="logo__text1">
<h3>KAŞ / ANTALYA</h3>
</div>
</div>
<div class="overlay"></div>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item amenities"><a class="nav-link" href="#amenities"><i class="fas fa-home nav--icon"></i>Amenities</a></li>
<li class="nav-item gallery"><a class="nav-link" href="#gallery"><i class="far fa-image nav--icon"></i>Gallery</a></li>
<li class="nav-item rooms"><a class="nav-link" href="#rooms"><i class="fas fa-bed nav--icon"></i>Rooms</a></li>
<li class="nav-item reviews"><a class="nav-link" href="#reviews"><i class="far fa-thumbs-up nav--icon"></i>Reviews</a></li>
<li class="nav-item activities"><a class="nav-link" href="#activities"><i class="fas fa-sun nav--icon"></i>Activities</a></li>
<li class="nav-item contact"><a class="nav-link" href="#contact"><i class="fas fa-envelope nav--icon"></i>Contact</a></li>
<!--<li class="nav-item"><a class="nav-link availability-button" href="https://www.airbnb.com/rooms/18783099">Check Availability</a></li>-->
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</div>
<div class="hero-area"></div>
<!--Amenities Text--->
<section id="amenities" class="section-header-area">
<div class="section-header">
<h2><strong>Amenities</strong> Villa Mavi Manzara</h2>
</div>
<!--Amenities Blurbs--->
<div class="info-blurbs">1</div>
</section>
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
<!--Room Details Text--->
<section id="rooms" class="section-header-area">
<div class="section-header">
<h2><strong>Room</strong> Details</h2>
</div>
<!--Rooms-->
<div class="container-rooms">3</div>
</section>
<!--Review Text--->
<section id="reviews" class="section-header-area">
<div class="section-header">
<h2><strong>Reviews</strong> Villa Mavi Manzara</h2>
</div>
<!--Reviews-->
<div class="container-reviews">4</div>
</section>
<!--Activities Text--->
<section id="activities" class="section-header-area">
<div class="section-header">
<h2><strong>Activities</strong> Villa Mavi Manzara</h2>
</div>
<!--Activities-->
<div class="container-activities">5</div>
</section>
<!--Contact Text--->
<section id="contact" class="section-header-area">
<div class="section-header">
<h2><strong>Contact</strong> Us</h2>
</div>
<!--Contact Section-->
<div class="container-contact">6</div>
</section>
-----------------------
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
</section>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
<!-- div should be nested within section to not throw off anchor -->
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
const sections = document.querySelectorAll("section");
const navLi = document.querySelectorAll(".nav li");
window.addEventListener("scroll", () => {
let current = "";
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= sectionTop - sectionHeight / 3) {
current = section.getAttribute("id");
}
});
navLi.forEach((li) => {
li.classList.remove("active-link");
if (li.classList.contains(current)) {
li.classList.add("active-link");
}
});
});
/*Menu Toggle*/
$(".menu-toggle").click(function() {
$(".nav").toggleClass("nav--open", 500);
$(".overlay").toggleClass("showOverlay");
$(this).toggleClass("open");
});
$(".overlay").click(function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
$(".nav a").on("click", function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
/*Smooth Scrolling*/
// Get the height of the header for offsetting
var headerHeight = $(".header-container").height();
// Attach the click event
$('.nav-link').bind("click", function(e) {
var target = $(this).attr("href"); //Get the target
var scrollToPosition = $(target).offset().top - headerHeight;
$('html').animate({
'scrollTop': scrollToPosition
}, 900, function(target) {
window.location.hash = target;
});
e.preventDefault();
});
<!--Back To Top Script-->
window.addEventListener('scroll', function() {
var scroll = document.querySelector('.scrollTop');
scroll.classList.toggle("active", window.scrollY > 500)
})
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
/*My Special Menu*/
html {
overflow-x: hidden;
}
.header-container {
background: -webkit-linear-gradient(left, #7abff6 0%, #03a9f4 100%);
color: #fff;
width: 100%;
position: fixed;
top: 0;
z-index: 999;
}
.container {
/*width: 95%;
max-width: 1000px;
*/
width: 90%;
max-width: 1600px;
height: 84.4px;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.logo__text {
text-transform: uppercase;
font-weight: 700;
font-size: 30px;
padding: 18px;
}
.logo__text span {
font-weight: 400;
margin-left: 6px;
}
.logo__text1 {
font-size: 13px;
padding-left: 220px;
}
.logo__text1 h3 {
font-weight: 300;
}
/*a.nav-link.availability-button {
color: #ffffff !important;
border-width: 0px !important;
letter-spacing: 1.5px;
font-size: 14px;
font-weight: 700 !important;
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}
a.nav-link.availability-button:hover {
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}*/
.nav a.active {
color: #fff;
}
.nav {
position: absolute;
background: #fff;
-webkit-clip-path: circle(0px at top right);
clip-path: circle(0px at top right);
transition: -webkit-clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms, -webkit-clip-path ease-in-out 700ms;
}
.nav--open {
-webkit-clip-path: circle(250% at top right);
clip-path: circle(250% at top right);
}
.nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
border-bottom: 1px solid #575766;
border-left: 1px solid #575766;
border-right: 1px solid #575766;
}
.nav li:last-child {
border-bottom: none;
}
@media screen and (max-width: 1240px) {
/*.nav li:last-child {
display: none;
}*/
}
@media screen and (min-width: 1200px) {
.check-button {
display: none !important;
}
}
.nav-link {
color: #000;
font-size: 14px;
display: block;
padding: 2em 4em 2em 1.5em;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
outline: none;
}
/*.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}*/
.nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
/*color: #000;*/
}
i.fas.fa-home.nav--icon {
color: #552401;
}
i.far.fa-image.nav--icon {
color: #9a57d8;
}
i.fas.fa-bed.nav--icon {
color: #ef991f;
}
i.far.fa-thumbs-up.nav--icon {
color: #5912d0;
}
i.fas.fa-sun.nav--icon {
color: #f2da08;
}
i.fas.fa-envelope.nav--icon {
color: #0a2fa0;
}
.menu-toggle {
padding: 1em;
padding-right: 50px;
position: absolute;
top: 1em;
right: -25px;
cursor: pointer;
z-index: 3;
}
@media only screen and (min-width: 480px) {
.menu-toggle {
top: 1.6em;
}
}
@media only screen and (max-width: 479px) {
.container {
height: 70px;
}
.menu-toggle {
top: 1.2em;
}
.nav {
top: 70px !important;
}
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: "";
display: block;
background: #fff;
height: 3px;
width: 1.75em;
border-radius: 3px;
-webkit-transition: all ease-in-out 500ms;
-o-transition: all ease-in-out 500ms;
transition: all ease-in-out 500ms;
}
.hamburger::before {
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.hamburger::after {
-webkit-transform: translateY(3px);
-ms-transform: translateY(3px);
transform: translateY(3px);
}
.open .hamburger {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
-webkit-transform: translateY(-3px) rotate(-90deg);
-ms-transform: translateY(-3px) rotate(-90deg);
transform: translateY(-3px) rotate(-90deg);
}
@media only screen and (max-width: 982px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}
}
@media only screen and (max-width: 602px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (max-width: 480px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (min-width: 983px) {
.menu-toggle {
display: none;
}
.nav {
height: auto;
position: relative;
background: transparent;
clip-path: initial;
-webkit-clip-path: initial;
}
.nav li {
display: inline-block;
border: none;
}
.nav a {
padding: 0.5em;
/*margin-left: 1em;*/
color: #fff;
}
.nav-item {
position: relative;
}
.nav-item:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: #edbb5f;
transition: all 0.5s ease-in-out;
z-index: -1;
}
.nav-item:hover:before {
width: 100%;
}
nav ul li.active-link {
background: #edbb5f;
}
/*.nav a:hover,
.nav a:focus {
background: #edbb5f;
padding: 7px;
}*/
.nav--icon {
display: none !important;
}
}
@media only screen and (max-width: 480px) {
.nav a {
padding: 1.3em 2.5em 1.3em 1em;
}
.logo__text {
padding: 18px 18px 18px 0;
font-size: 22px;
margin-left: 0;
}
.container {
max-width: 480px;
}
}
@media only screen and (max-width: 361px) {
.logo__text {
font-size: 20px;
}
.logo__text1 {
font-size: 10px;
}
}
/*End My Special Menu*/
.section-header-area {
background: url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/villa-blueview-bg02.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding: 30px 10px;
}
@media only screen and (max-width: 767px) {
.section-header-area {}
}
.section-header {
text-align: center;
}
.section-header h2 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 44px;
color: #565656 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
.section-header h2 {
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent;
background: -webkit-linear-gradient(left, #1e83ec 0%, #f6653c 100%);
}
strong {
font-weight: 700;
}
.section-header h3 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 1.6vw;
color: #767676 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
@media only screen and (max-width: 980px) {
.section-header h2 {
font-size: 44px;
}
.section-header h3 {
font-size: 26px;
}
}
@media only screen and (max-width: 767px) {
.section-header h2 {
font-size: 34px;
}
.section-header h3 {
font-size: 16px;
}
}
@media only screen and (max-width: 620px) {
.section-header h2 {
font-size: 28px;
}
}
/*Back To Top*/
.scrollTop {
position: fixed;
bottom: 800px;
right: 23px;
width: 50px;
height: 50px;
background: #399cf1 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
border-radius: 50%;
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
z-index: 10;
visibility: hidden;
opacity: 0;
transition: 0.5s;
}
.scrollTop.active {
bottom: 100px;
visibility: visible;
opacity: 1;
}
.scrollTop:hover {
background: #66b5f8 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
}
.overlay {
position: fixed;
display: none;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0);
width: 100%;
height: 100vh;
z-index: 2;
}
.showOverlay {
display: block;
}
@media only screen and (min-width: 983px) {
/*to stop overlay coming into screen on desktop when clicked on menu links otherwise it brings overlay layer on top of sections then it needs to be clicked on to make it dissappear */
.showOverlay {
display: none;
}
}
.hero-area {
height: 800px;
background-color: blanchedalmond;
}
.info-blurbs {
height: 800px;
background-color: red;
}
.container-grid-masonry {
height: 700px;
background-color: yellow;
}
.container-rooms {
height: 700px;
background-color: green;
}
.container-reviews {
height: 700px;
background-color: pink;
}
.container-activities {
height: 700px;
background-color: #ddd;
}
.container-contact {
height: 1200px;
background-color: lightblue;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="scrollTop" onclick="scrollToTop();"></div>
<div class="header-container">
<div class="container">
<div class="logo__text">Vİlla<span>Mavİ Manzara</span>
<div class="logo__text1">
<h3>KAŞ / ANTALYA</h3>
</div>
</div>
<div class="overlay"></div>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item amenities"><a class="nav-link" href="#amenities"><i class="fas fa-home nav--icon"></i>Amenities</a></li>
<li class="nav-item gallery"><a class="nav-link" href="#gallery"><i class="far fa-image nav--icon"></i>Gallery</a></li>
<li class="nav-item rooms"><a class="nav-link" href="#rooms"><i class="fas fa-bed nav--icon"></i>Rooms</a></li>
<li class="nav-item reviews"><a class="nav-link" href="#reviews"><i class="far fa-thumbs-up nav--icon"></i>Reviews</a></li>
<li class="nav-item activities"><a class="nav-link" href="#activities"><i class="fas fa-sun nav--icon"></i>Activities</a></li>
<li class="nav-item contact"><a class="nav-link" href="#contact"><i class="fas fa-envelope nav--icon"></i>Contact</a></li>
<!--<li class="nav-item"><a class="nav-link availability-button" href="https://www.airbnb.com/rooms/18783099">Check Availability</a></li>-->
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</div>
<div class="hero-area"></div>
<!--Amenities Text--->
<section id="amenities" class="section-header-area">
<div class="section-header">
<h2><strong>Amenities</strong> Villa Mavi Manzara</h2>
</div>
<!--Amenities Blurbs--->
<div class="info-blurbs">1</div>
</section>
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
<!--Room Details Text--->
<section id="rooms" class="section-header-area">
<div class="section-header">
<h2><strong>Room</strong> Details</h2>
</div>
<!--Rooms-->
<div class="container-rooms">3</div>
</section>
<!--Review Text--->
<section id="reviews" class="section-header-area">
<div class="section-header">
<h2><strong>Reviews</strong> Villa Mavi Manzara</h2>
</div>
<!--Reviews-->
<div class="container-reviews">4</div>
</section>
<!--Activities Text--->
<section id="activities" class="section-header-area">
<div class="section-header">
<h2><strong>Activities</strong> Villa Mavi Manzara</h2>
</div>
<!--Activities-->
<div class="container-activities">5</div>
</section>
<!--Contact Text--->
<section id="contact" class="section-header-area">
<div class="section-header">
<h2><strong>Contact</strong> Us</h2>
</div>
<!--Contact Section-->
<div class="container-contact">6</div>
</section>
-----------------------
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
</section>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
<!-- div should be nested within section to not throw off anchor -->
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
const sections = document.querySelectorAll("section");
const navLi = document.querySelectorAll(".nav li");
window.addEventListener("scroll", () => {
let current = "";
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= sectionTop - sectionHeight / 3) {
current = section.getAttribute("id");
}
});
navLi.forEach((li) => {
li.classList.remove("active-link");
if (li.classList.contains(current)) {
li.classList.add("active-link");
}
});
});
/*Menu Toggle*/
$(".menu-toggle").click(function() {
$(".nav").toggleClass("nav--open", 500);
$(".overlay").toggleClass("showOverlay");
$(this).toggleClass("open");
});
$(".overlay").click(function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
$(".nav a").on("click", function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
/*Smooth Scrolling*/
// Get the height of the header for offsetting
var headerHeight = $(".header-container").height();
// Attach the click event
$('.nav-link').bind("click", function(e) {
var target = $(this).attr("href"); //Get the target
var scrollToPosition = $(target).offset().top - headerHeight;
$('html').animate({
'scrollTop': scrollToPosition
}, 900, function(target) {
window.location.hash = target;
});
e.preventDefault();
});
<!--Back To Top Script-->
window.addEventListener('scroll', function() {
var scroll = document.querySelector('.scrollTop');
scroll.classList.toggle("active", window.scrollY > 500)
})
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
/*My Special Menu*/
html {
overflow-x: hidden;
}
.header-container {
background: -webkit-linear-gradient(left, #7abff6 0%, #03a9f4 100%);
color: #fff;
width: 100%;
position: fixed;
top: 0;
z-index: 999;
}
.container {
/*width: 95%;
max-width: 1000px;
*/
width: 90%;
max-width: 1600px;
height: 84.4px;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.logo__text {
text-transform: uppercase;
font-weight: 700;
font-size: 30px;
padding: 18px;
}
.logo__text span {
font-weight: 400;
margin-left: 6px;
}
.logo__text1 {
font-size: 13px;
padding-left: 220px;
}
.logo__text1 h3 {
font-weight: 300;
}
/*a.nav-link.availability-button {
color: #ffffff !important;
border-width: 0px !important;
letter-spacing: 1.5px;
font-size: 14px;
font-weight: 700 !important;
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}
a.nav-link.availability-button:hover {
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}*/
.nav a.active {
color: #fff;
}
.nav {
position: absolute;
background: #fff;
-webkit-clip-path: circle(0px at top right);
clip-path: circle(0px at top right);
transition: -webkit-clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms, -webkit-clip-path ease-in-out 700ms;
}
.nav--open {
-webkit-clip-path: circle(250% at top right);
clip-path: circle(250% at top right);
}
.nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
border-bottom: 1px solid #575766;
border-left: 1px solid #575766;
border-right: 1px solid #575766;
}
.nav li:last-child {
border-bottom: none;
}
@media screen and (max-width: 1240px) {
/*.nav li:last-child {
display: none;
}*/
}
@media screen and (min-width: 1200px) {
.check-button {
display: none !important;
}
}
.nav-link {
color: #000;
font-size: 14px;
display: block;
padding: 2em 4em 2em 1.5em;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
outline: none;
}
/*.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}*/
.nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
/*color: #000;*/
}
i.fas.fa-home.nav--icon {
color: #552401;
}
i.far.fa-image.nav--icon {
color: #9a57d8;
}
i.fas.fa-bed.nav--icon {
color: #ef991f;
}
i.far.fa-thumbs-up.nav--icon {
color: #5912d0;
}
i.fas.fa-sun.nav--icon {
color: #f2da08;
}
i.fas.fa-envelope.nav--icon {
color: #0a2fa0;
}
.menu-toggle {
padding: 1em;
padding-right: 50px;
position: absolute;
top: 1em;
right: -25px;
cursor: pointer;
z-index: 3;
}
@media only screen and (min-width: 480px) {
.menu-toggle {
top: 1.6em;
}
}
@media only screen and (max-width: 479px) {
.container {
height: 70px;
}
.menu-toggle {
top: 1.2em;
}
.nav {
top: 70px !important;
}
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: "";
display: block;
background: #fff;
height: 3px;
width: 1.75em;
border-radius: 3px;
-webkit-transition: all ease-in-out 500ms;
-o-transition: all ease-in-out 500ms;
transition: all ease-in-out 500ms;
}
.hamburger::before {
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.hamburger::after {
-webkit-transform: translateY(3px);
-ms-transform: translateY(3px);
transform: translateY(3px);
}
.open .hamburger {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
-webkit-transform: translateY(-3px) rotate(-90deg);
-ms-transform: translateY(-3px) rotate(-90deg);
transform: translateY(-3px) rotate(-90deg);
}
@media only screen and (max-width: 982px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}
}
@media only screen and (max-width: 602px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (max-width: 480px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (min-width: 983px) {
.menu-toggle {
display: none;
}
.nav {
height: auto;
position: relative;
background: transparent;
clip-path: initial;
-webkit-clip-path: initial;
}
.nav li {
display: inline-block;
border: none;
}
.nav a {
padding: 0.5em;
/*margin-left: 1em;*/
color: #fff;
}
.nav-item {
position: relative;
}
.nav-item:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: #edbb5f;
transition: all 0.5s ease-in-out;
z-index: -1;
}
.nav-item:hover:before {
width: 100%;
}
nav ul li.active-link {
background: #edbb5f;
}
/*.nav a:hover,
.nav a:focus {
background: #edbb5f;
padding: 7px;
}*/
.nav--icon {
display: none !important;
}
}
@media only screen and (max-width: 480px) {
.nav a {
padding: 1.3em 2.5em 1.3em 1em;
}
.logo__text {
padding: 18px 18px 18px 0;
font-size: 22px;
margin-left: 0;
}
.container {
max-width: 480px;
}
}
@media only screen and (max-width: 361px) {
.logo__text {
font-size: 20px;
}
.logo__text1 {
font-size: 10px;
}
}
/*End My Special Menu*/
.section-header-area {
background: url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/villa-blueview-bg02.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding: 30px 10px;
}
@media only screen and (max-width: 767px) {
.section-header-area {}
}
.section-header {
text-align: center;
}
.section-header h2 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 44px;
color: #565656 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
.section-header h2 {
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent;
background: -webkit-linear-gradient(left, #1e83ec 0%, #f6653c 100%);
}
strong {
font-weight: 700;
}
.section-header h3 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 1.6vw;
color: #767676 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
@media only screen and (max-width: 980px) {
.section-header h2 {
font-size: 44px;
}
.section-header h3 {
font-size: 26px;
}
}
@media only screen and (max-width: 767px) {
.section-header h2 {
font-size: 34px;
}
.section-header h3 {
font-size: 16px;
}
}
@media only screen and (max-width: 620px) {
.section-header h2 {
font-size: 28px;
}
}
/*Back To Top*/
.scrollTop {
position: fixed;
bottom: 800px;
right: 23px;
width: 50px;
height: 50px;
background: #399cf1 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
border-radius: 50%;
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
z-index: 10;
visibility: hidden;
opacity: 0;
transition: 0.5s;
}
.scrollTop.active {
bottom: 100px;
visibility: visible;
opacity: 1;
}
.scrollTop:hover {
background: #66b5f8 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
}
.overlay {
position: fixed;
display: none;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0);
width: 100%;
height: 100vh;
z-index: 2;
}
.showOverlay {
display: block;
}
@media only screen and (min-width: 983px) {
/*to stop overlay coming into screen on desktop when clicked on menu links otherwise it brings overlay layer on top of sections then it needs to be clicked on to make it dissappear */
.showOverlay {
display: none;
}
}
.hero-area {
height: 800px;
background-color: blanchedalmond;
}
.info-blurbs {
height: 800px;
background-color: red;
}
.container-grid-masonry {
height: 700px;
background-color: yellow;
}
.container-rooms {
height: 700px;
background-color: green;
}
.container-reviews {
height: 700px;
background-color: pink;
}
.container-activities {
height: 700px;
background-color: #ddd;
}
.container-contact {
height: 1200px;
background-color: lightblue;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="scrollTop" onclick="scrollToTop();"></div>
<div class="header-container">
<div class="container">
<div class="logo__text">Vİlla<span>Mavİ Manzara</span>
<div class="logo__text1">
<h3>KAŞ / ANTALYA</h3>
</div>
</div>
<div class="overlay"></div>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item amenities"><a class="nav-link" href="#amenities"><i class="fas fa-home nav--icon"></i>Amenities</a></li>
<li class="nav-item gallery"><a class="nav-link" href="#gallery"><i class="far fa-image nav--icon"></i>Gallery</a></li>
<li class="nav-item rooms"><a class="nav-link" href="#rooms"><i class="fas fa-bed nav--icon"></i>Rooms</a></li>
<li class="nav-item reviews"><a class="nav-link" href="#reviews"><i class="far fa-thumbs-up nav--icon"></i>Reviews</a></li>
<li class="nav-item activities"><a class="nav-link" href="#activities"><i class="fas fa-sun nav--icon"></i>Activities</a></li>
<li class="nav-item contact"><a class="nav-link" href="#contact"><i class="fas fa-envelope nav--icon"></i>Contact</a></li>
<!--<li class="nav-item"><a class="nav-link availability-button" href="https://www.airbnb.com/rooms/18783099">Check Availability</a></li>-->
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</div>
<div class="hero-area"></div>
<!--Amenities Text--->
<section id="amenities" class="section-header-area">
<div class="section-header">
<h2><strong>Amenities</strong> Villa Mavi Manzara</h2>
</div>
<!--Amenities Blurbs--->
<div class="info-blurbs">1</div>
</section>
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
<!--Room Details Text--->
<section id="rooms" class="section-header-area">
<div class="section-header">
<h2><strong>Room</strong> Details</h2>
</div>
<!--Rooms-->
<div class="container-rooms">3</div>
</section>
<!--Review Text--->
<section id="reviews" class="section-header-area">
<div class="section-header">
<h2><strong>Reviews</strong> Villa Mavi Manzara</h2>
</div>
<!--Reviews-->
<div class="container-reviews">4</div>
</section>
<!--Activities Text--->
<section id="activities" class="section-header-area">
<div class="section-header">
<h2><strong>Activities</strong> Villa Mavi Manzara</h2>
</div>
<!--Activities-->
<div class="container-activities">5</div>
</section>
<!--Contact Text--->
<section id="contact" class="section-header-area">
<div class="section-header">
<h2><strong>Contact</strong> Us</h2>
</div>
<!--Contact Section-->
<div class="container-contact">6</div>
</section>
-----------------------
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
</section>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
<!-- div should be nested within section to not throw off anchor -->
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
const sections = document.querySelectorAll("section");
const navLi = document.querySelectorAll(".nav li");
window.addEventListener("scroll", () => {
let current = "";
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= sectionTop - sectionHeight / 3) {
current = section.getAttribute("id");
}
});
navLi.forEach((li) => {
li.classList.remove("active-link");
if (li.classList.contains(current)) {
li.classList.add("active-link");
}
});
});
/*Menu Toggle*/
$(".menu-toggle").click(function() {
$(".nav").toggleClass("nav--open", 500);
$(".overlay").toggleClass("showOverlay");
$(this).toggleClass("open");
});
$(".overlay").click(function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
$(".nav a").on("click", function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
/*Smooth Scrolling*/
// Get the height of the header for offsetting
var headerHeight = $(".header-container").height();
// Attach the click event
$('.nav-link').bind("click", function(e) {
var target = $(this).attr("href"); //Get the target
var scrollToPosition = $(target).offset().top - headerHeight;
$('html').animate({
'scrollTop': scrollToPosition
}, 900, function(target) {
window.location.hash = target;
});
e.preventDefault();
});
<!--Back To Top Script-->
window.addEventListener('scroll', function() {
var scroll = document.querySelector('.scrollTop');
scroll.classList.toggle("active", window.scrollY > 500)
})
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
/*My Special Menu*/
html {
overflow-x: hidden;
}
.header-container {
background: -webkit-linear-gradient(left, #7abff6 0%, #03a9f4 100%);
color: #fff;
width: 100%;
position: fixed;
top: 0;
z-index: 999;
}
.container {
/*width: 95%;
max-width: 1000px;
*/
width: 90%;
max-width: 1600px;
height: 84.4px;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.logo__text {
text-transform: uppercase;
font-weight: 700;
font-size: 30px;
padding: 18px;
}
.logo__text span {
font-weight: 400;
margin-left: 6px;
}
.logo__text1 {
font-size: 13px;
padding-left: 220px;
}
.logo__text1 h3 {
font-weight: 300;
}
/*a.nav-link.availability-button {
color: #ffffff !important;
border-width: 0px !important;
letter-spacing: 1.5px;
font-size: 14px;
font-weight: 700 !important;
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}
a.nav-link.availability-button:hover {
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}*/
.nav a.active {
color: #fff;
}
.nav {
position: absolute;
background: #fff;
-webkit-clip-path: circle(0px at top right);
clip-path: circle(0px at top right);
transition: -webkit-clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms, -webkit-clip-path ease-in-out 700ms;
}
.nav--open {
-webkit-clip-path: circle(250% at top right);
clip-path: circle(250% at top right);
}
.nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
border-bottom: 1px solid #575766;
border-left: 1px solid #575766;
border-right: 1px solid #575766;
}
.nav li:last-child {
border-bottom: none;
}
@media screen and (max-width: 1240px) {
/*.nav li:last-child {
display: none;
}*/
}
@media screen and (min-width: 1200px) {
.check-button {
display: none !important;
}
}
.nav-link {
color: #000;
font-size: 14px;
display: block;
padding: 2em 4em 2em 1.5em;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
outline: none;
}
/*.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}*/
.nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
/*color: #000;*/
}
i.fas.fa-home.nav--icon {
color: #552401;
}
i.far.fa-image.nav--icon {
color: #9a57d8;
}
i.fas.fa-bed.nav--icon {
color: #ef991f;
}
i.far.fa-thumbs-up.nav--icon {
color: #5912d0;
}
i.fas.fa-sun.nav--icon {
color: #f2da08;
}
i.fas.fa-envelope.nav--icon {
color: #0a2fa0;
}
.menu-toggle {
padding: 1em;
padding-right: 50px;
position: absolute;
top: 1em;
right: -25px;
cursor: pointer;
z-index: 3;
}
@media only screen and (min-width: 480px) {
.menu-toggle {
top: 1.6em;
}
}
@media only screen and (max-width: 479px) {
.container {
height: 70px;
}
.menu-toggle {
top: 1.2em;
}
.nav {
top: 70px !important;
}
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: "";
display: block;
background: #fff;
height: 3px;
width: 1.75em;
border-radius: 3px;
-webkit-transition: all ease-in-out 500ms;
-o-transition: all ease-in-out 500ms;
transition: all ease-in-out 500ms;
}
.hamburger::before {
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.hamburger::after {
-webkit-transform: translateY(3px);
-ms-transform: translateY(3px);
transform: translateY(3px);
}
.open .hamburger {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
-webkit-transform: translateY(-3px) rotate(-90deg);
-ms-transform: translateY(-3px) rotate(-90deg);
transform: translateY(-3px) rotate(-90deg);
}
@media only screen and (max-width: 982px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}
}
@media only screen and (max-width: 602px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (max-width: 480px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (min-width: 983px) {
.menu-toggle {
display: none;
}
.nav {
height: auto;
position: relative;
background: transparent;
clip-path: initial;
-webkit-clip-path: initial;
}
.nav li {
display: inline-block;
border: none;
}
.nav a {
padding: 0.5em;
/*margin-left: 1em;*/
color: #fff;
}
.nav-item {
position: relative;
}
.nav-item:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: #edbb5f;
transition: all 0.5s ease-in-out;
z-index: -1;
}
.nav-item:hover:before {
width: 100%;
}
nav ul li.active-link {
background: #edbb5f;
}
/*.nav a:hover,
.nav a:focus {
background: #edbb5f;
padding: 7px;
}*/
.nav--icon {
display: none !important;
}
}
@media only screen and (max-width: 480px) {
.nav a {
padding: 1.3em 2.5em 1.3em 1em;
}
.logo__text {
padding: 18px 18px 18px 0;
font-size: 22px;
margin-left: 0;
}
.container {
max-width: 480px;
}
}
@media only screen and (max-width: 361px) {
.logo__text {
font-size: 20px;
}
.logo__text1 {
font-size: 10px;
}
}
/*End My Special Menu*/
.section-header-area {
background: url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/villa-blueview-bg02.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding: 30px 10px;
}
@media only screen and (max-width: 767px) {
.section-header-area {}
}
.section-header {
text-align: center;
}
.section-header h2 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 44px;
color: #565656 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
.section-header h2 {
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent;
background: -webkit-linear-gradient(left, #1e83ec 0%, #f6653c 100%);
}
strong {
font-weight: 700;
}
.section-header h3 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 1.6vw;
color: #767676 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
@media only screen and (max-width: 980px) {
.section-header h2 {
font-size: 44px;
}
.section-header h3 {
font-size: 26px;
}
}
@media only screen and (max-width: 767px) {
.section-header h2 {
font-size: 34px;
}
.section-header h3 {
font-size: 16px;
}
}
@media only screen and (max-width: 620px) {
.section-header h2 {
font-size: 28px;
}
}
/*Back To Top*/
.scrollTop {
position: fixed;
bottom: 800px;
right: 23px;
width: 50px;
height: 50px;
background: #399cf1 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
border-radius: 50%;
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
z-index: 10;
visibility: hidden;
opacity: 0;
transition: 0.5s;
}
.scrollTop.active {
bottom: 100px;
visibility: visible;
opacity: 1;
}
.scrollTop:hover {
background: #66b5f8 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
}
.overlay {
position: fixed;
display: none;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0);
width: 100%;
height: 100vh;
z-index: 2;
}
.showOverlay {
display: block;
}
@media only screen and (min-width: 983px) {
/*to stop overlay coming into screen on desktop when clicked on menu links otherwise it brings overlay layer on top of sections then it needs to be clicked on to make it dissappear */
.showOverlay {
display: none;
}
}
.hero-area {
height: 800px;
background-color: blanchedalmond;
}
.info-blurbs {
height: 800px;
background-color: red;
}
.container-grid-masonry {
height: 700px;
background-color: yellow;
}
.container-rooms {
height: 700px;
background-color: green;
}
.container-reviews {
height: 700px;
background-color: pink;
}
.container-activities {
height: 700px;
background-color: #ddd;
}
.container-contact {
height: 1200px;
background-color: lightblue;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="scrollTop" onclick="scrollToTop();"></div>
<div class="header-container">
<div class="container">
<div class="logo__text">Vİlla<span>Mavİ Manzara</span>
<div class="logo__text1">
<h3>KAŞ / ANTALYA</h3>
</div>
</div>
<div class="overlay"></div>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item amenities"><a class="nav-link" href="#amenities"><i class="fas fa-home nav--icon"></i>Amenities</a></li>
<li class="nav-item gallery"><a class="nav-link" href="#gallery"><i class="far fa-image nav--icon"></i>Gallery</a></li>
<li class="nav-item rooms"><a class="nav-link" href="#rooms"><i class="fas fa-bed nav--icon"></i>Rooms</a></li>
<li class="nav-item reviews"><a class="nav-link" href="#reviews"><i class="far fa-thumbs-up nav--icon"></i>Reviews</a></li>
<li class="nav-item activities"><a class="nav-link" href="#activities"><i class="fas fa-sun nav--icon"></i>Activities</a></li>
<li class="nav-item contact"><a class="nav-link" href="#contact"><i class="fas fa-envelope nav--icon"></i>Contact</a></li>
<!--<li class="nav-item"><a class="nav-link availability-button" href="https://www.airbnb.com/rooms/18783099">Check Availability</a></li>-->
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</div>
<div class="hero-area"></div>
<!--Amenities Text--->
<section id="amenities" class="section-header-area">
<div class="section-header">
<h2><strong>Amenities</strong> Villa Mavi Manzara</h2>
</div>
<!--Amenities Blurbs--->
<div class="info-blurbs">1</div>
</section>
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
<!--Room Details Text--->
<section id="rooms" class="section-header-area">
<div class="section-header">
<h2><strong>Room</strong> Details</h2>
</div>
<!--Rooms-->
<div class="container-rooms">3</div>
</section>
<!--Review Text--->
<section id="reviews" class="section-header-area">
<div class="section-header">
<h2><strong>Reviews</strong> Villa Mavi Manzara</h2>
</div>
<!--Reviews-->
<div class="container-reviews">4</div>
</section>
<!--Activities Text--->
<section id="activities" class="section-header-area">
<div class="section-header">
<h2><strong>Activities</strong> Villa Mavi Manzara</h2>
</div>
<!--Activities-->
<div class="container-activities">5</div>
</section>
<!--Contact Text--->
<section id="contact" class="section-header-area">
<div class="section-header">
<h2><strong>Contact</strong> Us</h2>
</div>
<!--Contact Section-->
<div class="container-contact">6</div>
</section>
-----------------------
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
</section>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
<!-- div should be nested within section to not throw off anchor -->
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
const sections = document.querySelectorAll("section");
const navLi = document.querySelectorAll(".nav li");
window.addEventListener("scroll", () => {
let current = "";
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= sectionTop - sectionHeight / 3) {
current = section.getAttribute("id");
}
});
navLi.forEach((li) => {
li.classList.remove("active-link");
if (li.classList.contains(current)) {
li.classList.add("active-link");
}
});
});
/*Menu Toggle*/
$(".menu-toggle").click(function() {
$(".nav").toggleClass("nav--open", 500);
$(".overlay").toggleClass("showOverlay");
$(this).toggleClass("open");
});
$(".overlay").click(function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
$(".nav a").on("click", function() {
$(".menu-toggle").removeClass("open");
$(".nav").toggleClass("nav--open");
$(".overlay").removeClass("showOverlay");
});
/*Smooth Scrolling*/
// Get the height of the header for offsetting
var headerHeight = $(".header-container").height();
// Attach the click event
$('.nav-link').bind("click", function(e) {
var target = $(this).attr("href"); //Get the target
var scrollToPosition = $(target).offset().top - headerHeight;
$('html').animate({
'scrollTop': scrollToPosition
}, 900, function(target) {
window.location.hash = target;
});
e.preventDefault();
});
<!--Back To Top Script-->
window.addEventListener('scroll', function() {
var scroll = document.querySelector('.scrollTop');
scroll.classList.toggle("active", window.scrollY > 500)
})
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
/*My Special Menu*/
html {
overflow-x: hidden;
}
.header-container {
background: -webkit-linear-gradient(left, #7abff6 0%, #03a9f4 100%);
color: #fff;
width: 100%;
position: fixed;
top: 0;
z-index: 999;
}
.container {
/*width: 95%;
max-width: 1000px;
*/
width: 90%;
max-width: 1600px;
height: 84.4px;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.logo__text {
text-transform: uppercase;
font-weight: 700;
font-size: 30px;
padding: 18px;
}
.logo__text span {
font-weight: 400;
margin-left: 6px;
}
.logo__text1 {
font-size: 13px;
padding-left: 220px;
}
.logo__text1 h3 {
font-weight: 300;
}
/*a.nav-link.availability-button {
color: #ffffff !important;
border-width: 0px !important;
letter-spacing: 1.5px;
font-size: 14px;
font-weight: 700 !important;
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}
a.nav-link.availability-button:hover {
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
background-color: #edbb5f;
padding-top: 10px !important;
padding-right: 18px !important;
padding-bottom: 10px !important;
padding-left: 18px !important;
margin-left: 10px;
border-radius: 6px;
}*/
.nav a.active {
color: #fff;
}
.nav {
position: absolute;
background: #fff;
-webkit-clip-path: circle(0px at top right);
clip-path: circle(0px at top right);
transition: -webkit-clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms;
transition: clip-path ease-in-out 700ms, -webkit-clip-path ease-in-out 700ms;
}
.nav--open {
-webkit-clip-path: circle(250% at top right);
clip-path: circle(250% at top right);
}
.nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
border-bottom: 1px solid #575766;
border-left: 1px solid #575766;
border-right: 1px solid #575766;
}
.nav li:last-child {
border-bottom: none;
}
@media screen and (max-width: 1240px) {
/*.nav li:last-child {
display: none;
}*/
}
@media screen and (min-width: 1200px) {
.check-button {
display: none !important;
}
}
.nav-link {
color: #000;
font-size: 14px;
display: block;
padding: 2em 4em 2em 1.5em;
text-transform: uppercase;
text-decoration: none;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
outline: none;
}
/*.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}*/
.nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
/*color: #000;*/
}
i.fas.fa-home.nav--icon {
color: #552401;
}
i.far.fa-image.nav--icon {
color: #9a57d8;
}
i.fas.fa-bed.nav--icon {
color: #ef991f;
}
i.far.fa-thumbs-up.nav--icon {
color: #5912d0;
}
i.fas.fa-sun.nav--icon {
color: #f2da08;
}
i.fas.fa-envelope.nav--icon {
color: #0a2fa0;
}
.menu-toggle {
padding: 1em;
padding-right: 50px;
position: absolute;
top: 1em;
right: -25px;
cursor: pointer;
z-index: 3;
}
@media only screen and (min-width: 480px) {
.menu-toggle {
top: 1.6em;
}
}
@media only screen and (max-width: 479px) {
.container {
height: 70px;
}
.menu-toggle {
top: 1.2em;
}
.nav {
top: 70px !important;
}
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: "";
display: block;
background: #fff;
height: 3px;
width: 1.75em;
border-radius: 3px;
-webkit-transition: all ease-in-out 500ms;
-o-transition: all ease-in-out 500ms;
transition: all ease-in-out 500ms;
}
.hamburger::before {
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.hamburger::after {
-webkit-transform: translateY(3px);
-ms-transform: translateY(3px);
transform: translateY(3px);
}
.open .hamburger {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
-webkit-transform: translateY(-3px) rotate(-90deg);
-ms-transform: translateY(-3px) rotate(-90deg);
transform: translateY(-3px) rotate(-90deg);
}
@media only screen and (max-width: 982px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
.nav-link:hover,
.nav-link:focus {
background: #74d057;
color: #fff;
}
}
@media only screen and (max-width: 602px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (max-width: 480px) {
.nav {
right: 1px !important;
top: 84.4px;
z-index: 15;
}
}
@media only screen and (min-width: 983px) {
.menu-toggle {
display: none;
}
.nav {
height: auto;
position: relative;
background: transparent;
clip-path: initial;
-webkit-clip-path: initial;
}
.nav li {
display: inline-block;
border: none;
}
.nav a {
padding: 0.5em;
/*margin-left: 1em;*/
color: #fff;
}
.nav-item {
position: relative;
}
.nav-item:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: #edbb5f;
transition: all 0.5s ease-in-out;
z-index: -1;
}
.nav-item:hover:before {
width: 100%;
}
nav ul li.active-link {
background: #edbb5f;
}
/*.nav a:hover,
.nav a:focus {
background: #edbb5f;
padding: 7px;
}*/
.nav--icon {
display: none !important;
}
}
@media only screen and (max-width: 480px) {
.nav a {
padding: 1.3em 2.5em 1.3em 1em;
}
.logo__text {
padding: 18px 18px 18px 0;
font-size: 22px;
margin-left: 0;
}
.container {
max-width: 480px;
}
}
@media only screen and (max-width: 361px) {
.logo__text {
font-size: 20px;
}
.logo__text1 {
font-size: 10px;
}
}
/*End My Special Menu*/
.section-header-area {
background: url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/villa-blueview-bg02.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding: 30px 10px;
}
@media only screen and (max-width: 767px) {
.section-header-area {}
}
.section-header {
text-align: center;
}
.section-header h2 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 44px;
color: #565656 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
.section-header h2 {
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent;
background: -webkit-linear-gradient(left, #1e83ec 0%, #f6653c 100%);
}
strong {
font-weight: 700;
}
.section-header h3 {
font-family: "Lato", Helvetica, Arial, Lucida, sans-serif;
font-weight: 300;
font-size: 1.6vw;
color: #767676 !important;
letter-spacing: 1px;
line-height: 1.2em;
}
@media only screen and (max-width: 980px) {
.section-header h2 {
font-size: 44px;
}
.section-header h3 {
font-size: 26px;
}
}
@media only screen and (max-width: 767px) {
.section-header h2 {
font-size: 34px;
}
.section-header h3 {
font-size: 16px;
}
}
@media only screen and (max-width: 620px) {
.section-header h2 {
font-size: 28px;
}
}
/*Back To Top*/
.scrollTop {
position: fixed;
bottom: 800px;
right: 23px;
width: 50px;
height: 50px;
background: #399cf1 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
border-radius: 50%;
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
z-index: 10;
visibility: hidden;
opacity: 0;
transition: 0.5s;
}
.scrollTop.active {
bottom: 100px;
visibility: visible;
opacity: 1;
}
.scrollTop:hover {
background: #66b5f8 url(https://villablueview.cloudaccess.host/wp-content/uploads/2021/08/uparrow.png);
background-size: 30px;
background-position: center;
background-repeat: no-repeat;
}
.overlay {
position: fixed;
display: none;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0);
width: 100%;
height: 100vh;
z-index: 2;
}
.showOverlay {
display: block;
}
@media only screen and (min-width: 983px) {
/*to stop overlay coming into screen on desktop when clicked on menu links otherwise it brings overlay layer on top of sections then it needs to be clicked on to make it dissappear */
.showOverlay {
display: none;
}
}
.hero-area {
height: 800px;
background-color: blanchedalmond;
}
.info-blurbs {
height: 800px;
background-color: red;
}
.container-grid-masonry {
height: 700px;
background-color: yellow;
}
.container-rooms {
height: 700px;
background-color: green;
}
.container-reviews {
height: 700px;
background-color: pink;
}
.container-activities {
height: 700px;
background-color: #ddd;
}
.container-contact {
height: 1200px;
background-color: lightblue;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="scrollTop" onclick="scrollToTop();"></div>
<div class="header-container">
<div class="container">
<div class="logo__text">Vİlla<span>Mavİ Manzara</span>
<div class="logo__text1">
<h3>KAŞ / ANTALYA</h3>
</div>
</div>
<div class="overlay"></div>
<nav class="nav">
<ul class="nav-list">
<li class="nav-item amenities"><a class="nav-link" href="#amenities"><i class="fas fa-home nav--icon"></i>Amenities</a></li>
<li class="nav-item gallery"><a class="nav-link" href="#gallery"><i class="far fa-image nav--icon"></i>Gallery</a></li>
<li class="nav-item rooms"><a class="nav-link" href="#rooms"><i class="fas fa-bed nav--icon"></i>Rooms</a></li>
<li class="nav-item reviews"><a class="nav-link" href="#reviews"><i class="far fa-thumbs-up nav--icon"></i>Reviews</a></li>
<li class="nav-item activities"><a class="nav-link" href="#activities"><i class="fas fa-sun nav--icon"></i>Activities</a></li>
<li class="nav-item contact"><a class="nav-link" href="#contact"><i class="fas fa-envelope nav--icon"></i>Contact</a></li>
<!--<li class="nav-item"><a class="nav-link availability-button" href="https://www.airbnb.com/rooms/18783099">Check Availability</a></li>-->
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</div>
<div class="hero-area"></div>
<!--Amenities Text--->
<section id="amenities" class="section-header-area">
<div class="section-header">
<h2><strong>Amenities</strong> Villa Mavi Manzara</h2>
</div>
<!--Amenities Blurbs--->
<div class="info-blurbs">1</div>
</section>
<!--Gallery Text--->
<section id="gallery" class="section-header-area">
<div class="section-header">
<h2><strong>Photo</strong> Gallery</h2>
</div>
<!--Gallery--->
<div class="container-grid-masonry">2</div>
</section>
<!--Room Details Text--->
<section id="rooms" class="section-header-area">
<div class="section-header">
<h2><strong>Room</strong> Details</h2>
</div>
<!--Rooms-->
<div class="container-rooms">3</div>
</section>
<!--Review Text--->
<section id="reviews" class="section-header-area">
<div class="section-header">
<h2><strong>Reviews</strong> Villa Mavi Manzara</h2>
</div>
<!--Reviews-->
<div class="container-reviews">4</div>
</section>
<!--Activities Text--->
<section id="activities" class="section-header-area">
<div class="section-header">
<h2><strong>Activities</strong> Villa Mavi Manzara</h2>
</div>
<!--Activities-->
<div class="container-activities">5</div>
</section>
<!--Contact Text--->
<section id="contact" class="section-header-area">
<div class="section-header">
<h2><strong>Contact</strong> Us</h2>
</div>
<!--Contact Section-->
<div class="container-contact">6</div>
</section>
How to blend text onto a texture in three.js?
body{
overflow: hidden;
margin: 0;
}
<script type="module">
import * as THREE from "https://cdn.skypack.dev/three@0.136.0";
import {
OrbitControls
} from "https://cdn.skypack.dev/three@0.136.0/examples/jsm/controls/OrbitControls";
let scene = new THREE.Scene();
let camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 1000);
camera.position.set(0, 3, 8);
let renderer = new THREE.WebGLRenderer({
antialias: true
});
renderer.setSize(innerWidth, innerHeight);
//renderer.setClearColor(0xffffff)
document.body.appendChild(renderer.domElement);
window.addEventListener("resize", event => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
})
let controls = new OrbitControls(camera, renderer.domElement);
let light = new THREE.DirectionalLight(0xffffff, 1);
light.position.setScalar(1);
scene.add(light, new THREE.AmbientLight(0xffffff, 0.25));
let c = document.createElement("canvas");
c.width = 256;
c.height = 128;
let ctx = c.getContext("2d");
ctx.fillStyle = "rgba(255, 255, 255, 0)";
ctx.fillRect(0, 0, c.width, c.height);
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = "magenta";
ctx.font = "bold 36px Arial";
let text = "I love Three.js";
ctx.fillText(text, c.width * 0.5, c.height * 0.5);
ctx.strokeStyle = "red";
ctx.strokeText(text, c.width * 0.5, c.height * 0.5);
let tex = new THREE.CanvasTexture(c);
tex.offset.y = 0.25;
let u = {
time: {value: 0},
textTex: {value: tex}
}
let g = new THREE.CylinderGeometry(2, 2, 4.5, 36, 1, true);
g.rotateY(Math.PI);
let m = new THREE.MeshLambertMaterial({
color: 0x7f7f64,
map: new THREE.TextureLoader().load("https://threejs.org/examples/textures/floors/FloorsCheckerboard_S_Diffuse.jpg", tex => {
tex.wrapS = THREE.RepeatWrapping;
tex.wrapT = THREE.RepeatWrapping;
tex.repeat.set( 3, 1 );
}),
side: THREE.DoubleSide,
onBeforeCompile: shader => {
shader.uniforms.time = u.time;
shader.uniforms.textTex = u.textTex;
shader.fragmentShader = `
uniform float time;
uniform sampler2D textTex;
${shader.fragmentShader}
`.replace(
`#include <map_fragment>`,
`#include <map_fragment>
vec4 textCol = texture(textTex, (vUv * 2. - 0.5) + vec2(-2., sin(time) * 0.25));
vec3 col = mix(diffuseColor.rgb, textCol.rgb, textCol.a);
diffuseColor = vec4( col, opacity );
`
);
//console.log(shader.fragmentShader);
}
});
m.defines = {"USE_UV" : ""};
let o = new THREE.Mesh(g, m);
scene.add(o);
let clock = new THREE.Clock();
renderer.setAnimationLoop(() => {
let time = clock.getElapsedTime();
u.time.value = time;
renderer.render(scene, camera);
});
</script>
-----------------------
body{
overflow: hidden;
margin: 0;
}
<script type="module">
import * as THREE from "https://cdn.skypack.dev/three@0.136.0";
import {
OrbitControls
} from "https://cdn.skypack.dev/three@0.136.0/examples/jsm/controls/OrbitControls";
let scene = new THREE.Scene();
let camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 1000);
camera.position.set(0, 3, 8);
let renderer = new THREE.WebGLRenderer({
antialias: true
});
renderer.setSize(innerWidth, innerHeight);
//renderer.setClearColor(0xffffff)
document.body.appendChild(renderer.domElement);
window.addEventListener("resize", event => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
})
let controls = new OrbitControls(camera, renderer.domElement);
let light = new THREE.DirectionalLight(0xffffff, 1);
light.position.setScalar(1);
scene.add(light, new THREE.AmbientLight(0xffffff, 0.25));
let c = document.createElement("canvas");
c.width = 256;
c.height = 128;
let ctx = c.getContext("2d");
ctx.fillStyle = "rgba(255, 255, 255, 0)";
ctx.fillRect(0, 0, c.width, c.height);
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = "magenta";
ctx.font = "bold 36px Arial";
let text = "I love Three.js";
ctx.fillText(text, c.width * 0.5, c.height * 0.5);
ctx.strokeStyle = "red";
ctx.strokeText(text, c.width * 0.5, c.height * 0.5);
let tex = new THREE.CanvasTexture(c);
tex.offset.y = 0.25;
let u = {
time: {value: 0},
textTex: {value: tex}
}
let g = new THREE.CylinderGeometry(2, 2, 4.5, 36, 1, true);
g.rotateY(Math.PI);
let m = new THREE.MeshLambertMaterial({
color: 0x7f7f64,
map: new THREE.TextureLoader().load("https://threejs.org/examples/textures/floors/FloorsCheckerboard_S_Diffuse.jpg", tex => {
tex.wrapS = THREE.RepeatWrapping;
tex.wrapT = THREE.RepeatWrapping;
tex.repeat.set( 3, 1 );
}),
side: THREE.DoubleSide,
onBeforeCompile: shader => {
shader.uniforms.time = u.time;
shader.uniforms.textTex = u.textTex;
shader.fragmentShader = `
uniform float time;
uniform sampler2D textTex;
${shader.fragmentShader}
`.replace(
`#include <map_fragment>`,
`#include <map_fragment>
vec4 textCol = texture(textTex, (vUv * 2. - 0.5) + vec2(-2., sin(time) * 0.25));
vec3 col = mix(diffuseColor.rgb, textCol.rgb, textCol.a);
diffuseColor = vec4( col, opacity );
`
);
//console.log(shader.fragmentShader);
}
});
m.defines = {"USE_UV" : ""};
let o = new THREE.Mesh(g, m);
scene.add(o);
let clock = new THREE.Clock();
renderer.setAnimationLoop(() => {
let time = clock.getElapsedTime();
u.time.value = time;
renderer.render(scene, camera);
});
</script>
I cant use event in fuctions in tkinter
<Button-Variable-Name-Here>.bind("<Button-1>", click)
Vertically centering text within an R Shinydashboard box
.box {
display: flex;
align-items: center;
justify-content: center;
align-content: center;
}
.col-sm-6 + .col-sm-6 div.box {
font-weight: bold;
transform: rotate(-25deg);
}
.col-sm-6 + .col-sm-6 + .col-sm-6 div.box {
font-weight: normal;
transform: rotate(0deg);
}
#textbox2 {
transform: rotate(25deg);
}
Displaying selected info from Class Constructor into a table - Javascript
/* See/add options, remove options,
see overview of options and price
*/
// VARIABLES
let button = document.getElementById("submit");
let choice = document.getElementById("choice");
let row = document.getElementById('emptyRow');
let totalPriceElement = document.getElementById('totalPrice');
// OPTIONS CLASS CONSTRUCTOR
class CarOptions {
constructor(optionName, price) {
this.optionName = optionName;
this.price = price;
}
}
// create 6 options
let option = new CarOptions("", 0);
let vac = new CarOptions("vac", 150);
let trunk = new CarOptions("trunk", 2000);
let seat = new CarOptions("seat", 550);
let night = new CarOptions("night", 360);
let wifi = new CarOptions("wifi", 1200);
let park = new CarOptions("park", 600);
// Array of all objects
let allOptions = [option, vac, trunk, seat, night, wifi, park];
// Array of all object names
let allOptionsName = [option.optionName, vac.optionName, trunk.optionName, seat.optionName, night.optionName, wifi.optionName, park.optionName];
// EVENTS
// On submit event
button.addEventListener("click", (e) => {
e.preventDefault();
const selected = document.querySelectorAll('#choice option:checked');
// Displaying options names in the table
// CURRENTLY ALL DISPLAYS IN ONE ROW
for(let i = 0; i < selected.length;i++){
const values = Array.from(selected).map(el => el.value);
const element = allOptions.filter(option => {
return option.optionName == values[i];
});
var tableRow = document.createElement('TR');
var tableCellName = document.createElement('TD');
var tableCellPrice = document.createElement('TD');
tableCellName.setAttribute('class','option');
tableCellName.innerText = values[i];
tableCellPrice.setAttribute('class','price');
tableCellPrice.innerText = element[0].price;
tableRow.appendChild(tableCellName);
tableRow.appendChild(tableCellPrice);
row.appendChild(tableRow);
if(i == selected.length - 1){
display(values);
}
}
})
function display(values) {
const elements = allOptions.filter(option => {
for(let i = 0; i < values.length; i++){
if(option.optionName == values[i]){
return option;
}
else{
continue;
}
}
})
let totalPrice = 0;
for(let i = 0; i<elements.length;i++){
totalPrice += elements[i].price;
}
totalPriceElement.innerText = totalPrice;
return;
}
body {
background-color: black;
color: white;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
#form {
display: flex;
flex-direction: column;
width: 250px;
align-items: center;
}
#choice {
height: 120px;
}
.results {
width: 300px;
border: 2px dotted green;
margin: 10px;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Selection</title>
</head>
<body>
<h1>Car Choice</h1>
<h2>Ready to buy your dream car?</h2>
<div class="select">
<!-- Selection of food or drink -->
<form class="flexColumn" id="form">
<select name="choice" id="choice" multiple="true">
<option value="" name="">--Please choose an option--</option>
<option id="vac" value="vac" name="vac">Built-in Vacuum (€150)</option>
<option value="trunk" name="trunk">Automatic Opening Trunk (€2000)</option>
<option value="seat" name="seat">Massaging Seats (€550)</option>
<option value="night" name="night">Nightvision Dashboard System (€360)</option>
<option value="wifi" name="wifi">WiFi/Entertainment/Navigation (€1200)</option>
<option value="park" name="park">Self-Parking System (€600)</option>
</select>
<button id="submit" class="submit" submit>SUBMIT</button>
</form>
<p>Your current selected options:</p>
<div id="selection" class="selection">
<table class="results" style="width:200px">
<tr>
<th>Option</th>
<th>Price (€)</th>
</tr>
<tbody id="emptyRow">
</tbody>
<tr>
<td>TOTAL:</td>
<td id="totalPrice"></td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
-----------------------
/* See/add options, remove options,
see overview of options and price
*/
// VARIABLES
let button = document.getElementById("submit");
let choice = document.getElementById("choice");
let row = document.getElementById('emptyRow');
let totalPriceElement = document.getElementById('totalPrice');
// OPTIONS CLASS CONSTRUCTOR
class CarOptions {
constructor(optionName, price) {
this.optionName = optionName;
this.price = price;
}
}
// create 6 options
let option = new CarOptions("", 0);
let vac = new CarOptions("vac", 150);
let trunk = new CarOptions("trunk", 2000);
let seat = new CarOptions("seat", 550);
let night = new CarOptions("night", 360);
let wifi = new CarOptions("wifi", 1200);
let park = new CarOptions("park", 600);
// Array of all objects
let allOptions = [option, vac, trunk, seat, night, wifi, park];
// Array of all object names
let allOptionsName = [option.optionName, vac.optionName, trunk.optionName, seat.optionName, night.optionName, wifi.optionName, park.optionName];
// EVENTS
// On submit event
button.addEventListener("click", (e) => {
e.preventDefault();
const selected = document.querySelectorAll('#choice option:checked');
// Displaying options names in the table
// CURRENTLY ALL DISPLAYS IN ONE ROW
for(let i = 0; i < selected.length;i++){
const values = Array.from(selected).map(el => el.value);
const element = allOptions.filter(option => {
return option.optionName == values[i];
});
var tableRow = document.createElement('TR');
var tableCellName = document.createElement('TD');
var tableCellPrice = document.createElement('TD');
tableCellName.setAttribute('class','option');
tableCellName.innerText = values[i];
tableCellPrice.setAttribute('class','price');
tableCellPrice.innerText = element[0].price;
tableRow.appendChild(tableCellName);
tableRow.appendChild(tableCellPrice);
row.appendChild(tableRow);
if(i == selected.length - 1){
display(values);
}
}
})
function display(values) {
const elements = allOptions.filter(option => {
for(let i = 0; i < values.length; i++){
if(option.optionName == values[i]){
return option;
}
else{
continue;
}
}
})
let totalPrice = 0;
for(let i = 0; i<elements.length;i++){
totalPrice += elements[i].price;
}
totalPriceElement.innerText = totalPrice;
return;
}
body {
background-color: black;
color: white;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
#form {
display: flex;
flex-direction: column;
width: 250px;
align-items: center;
}
#choice {
height: 120px;
}
.results {
width: 300px;
border: 2px dotted green;
margin: 10px;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Selection</title>
</head>
<body>
<h1>Car Choice</h1>
<h2>Ready to buy your dream car?</h2>
<div class="select">
<!-- Selection of food or drink -->
<form class="flexColumn" id="form">
<select name="choice" id="choice" multiple="true">
<option value="" name="">--Please choose an option--</option>
<option id="vac" value="vac" name="vac">Built-in Vacuum (€150)</option>
<option value="trunk" name="trunk">Automatic Opening Trunk (€2000)</option>
<option value="seat" name="seat">Massaging Seats (€550)</option>
<option value="night" name="night">Nightvision Dashboard System (€360)</option>
<option value="wifi" name="wifi">WiFi/Entertainment/Navigation (€1200)</option>
<option value="park" name="park">Self-Parking System (€600)</option>
</select>
<button id="submit" class="submit" submit>SUBMIT</button>
</form>
<p>Your current selected options:</p>
<div id="selection" class="selection">
<table class="results" style="width:200px">
<tr>
<th>Option</th>
<th>Price (€)</th>
</tr>
<tbody id="emptyRow">
</tbody>
<tr>
<td>TOTAL:</td>
<td id="totalPrice"></td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
-----------------------
/* See/add options, remove options,
see overview of options and price
*/
// VARIABLES
let button = document.getElementById("submit");
let choice = document.getElementById("choice");
let row = document.getElementById('emptyRow');
let totalPriceElement = document.getElementById('totalPrice');
// OPTIONS CLASS CONSTRUCTOR
class CarOptions {
constructor(optionName, price) {
this.optionName = optionName;
this.price = price;
}
}
// create 6 options
let option = new CarOptions("", 0);
let vac = new CarOptions("vac", 150);
let trunk = new CarOptions("trunk", 2000);
let seat = new CarOptions("seat", 550);
let night = new CarOptions("night", 360);
let wifi = new CarOptions("wifi", 1200);
let park = new CarOptions("park", 600);
// Array of all objects
let allOptions = [option, vac, trunk, seat, night, wifi, park];
// Array of all object names
let allOptionsName = [option.optionName, vac.optionName, trunk.optionName, seat.optionName, night.optionName, wifi.optionName, park.optionName];
// EVENTS
// On submit event
button.addEventListener("click", (e) => {
e.preventDefault();
const selected = document.querySelectorAll('#choice option:checked');
// Displaying options names in the table
// CURRENTLY ALL DISPLAYS IN ONE ROW
for(let i = 0; i < selected.length;i++){
const values = Array.from(selected).map(el => el.value);
const element = allOptions.filter(option => {
return option.optionName == values[i];
});
var tableRow = document.createElement('TR');
var tableCellName = document.createElement('TD');
var tableCellPrice = document.createElement('TD');
tableCellName.setAttribute('class','option');
tableCellName.innerText = values[i];
tableCellPrice.setAttribute('class','price');
tableCellPrice.innerText = element[0].price;
tableRow.appendChild(tableCellName);
tableRow.appendChild(tableCellPrice);
row.appendChild(tableRow);
if(i == selected.length - 1){
display(values);
}
}
})
function display(values) {
const elements = allOptions.filter(option => {
for(let i = 0; i < values.length; i++){
if(option.optionName == values[i]){
return option;
}
else{
continue;
}
}
})
let totalPrice = 0;
for(let i = 0; i<elements.length;i++){
totalPrice += elements[i].price;
}
totalPriceElement.innerText = totalPrice;
return;
}
body {
background-color: black;
color: white;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
#form {
display: flex;
flex-direction: column;
width: 250px;
align-items: center;
}
#choice {
height: 120px;
}
.results {
width: 300px;
border: 2px dotted green;
margin: 10px;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Selection</title>
</head>
<body>
<h1>Car Choice</h1>
<h2>Ready to buy your dream car?</h2>
<div class="select">
<!-- Selection of food or drink -->
<form class="flexColumn" id="form">
<select name="choice" id="choice" multiple="true">
<option value="" name="">--Please choose an option--</option>
<option id="vac" value="vac" name="vac">Built-in Vacuum (€150)</option>
<option value="trunk" name="trunk">Automatic Opening Trunk (€2000)</option>
<option value="seat" name="seat">Massaging Seats (€550)</option>
<option value="night" name="night">Nightvision Dashboard System (€360)</option>
<option value="wifi" name="wifi">WiFi/Entertainment/Navigation (€1200)</option>
<option value="park" name="park">Self-Parking System (€600)</option>
</select>
<button id="submit" class="submit" submit>SUBMIT</button>
</form>
<p>Your current selected options:</p>
<div id="selection" class="selection">
<table class="results" style="width:200px">
<tr>
<th>Option</th>
<th>Price (€)</th>
</tr>
<tbody id="emptyRow">
</tbody>
<tr>
<td>TOTAL:</td>
<td id="totalPrice"></td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
-----------------------
/* See/add options, remove options,
see overview of options and price
*/
// VARIABLES
let button = document.querySelector("#submit");
let choice = document.querySelector("#choice");
// OPTIONS CLASS CONSTRUCTOR
class CarOptions {
constructor(optionName, price) {
this.optionName = optionName;
this.price = price;
}
}
// create 6 options
let option = new CarOptions("", 0);
let vac = new CarOptions("vac", 150);
let trunk = new CarOptions("trunk", 2000);
let seat = new CarOptions("seat", 550);
let night = new CarOptions("night", 360);
let wifi = new CarOptions("wifi", 1200);
let park = new CarOptions("park", 600);
// Array of all objects
let allOptions = [option, vac, trunk, seat, night, wifi, park];
// Array of all object names
let allOptionsName = [option.optionName, vac.optionName, trunk.optionName, seat.optionName, night.optionName, wifi.optionName, park.optionName];
// EVENTS
// On submit event
button.addEventListener("click", (e) => {
e.preventDefault();
const selected = document.querySelectorAll('#choice option:checked');
const values = Array.from(selected).map(el => el.value);
const res = allOptions.filter(a => values.includes(a.optionName))
const total = res.reduce((acc, v) => acc += v.price, 0 )
display(res, total);
})
function createTr() {
let tbodyRef = document.querySelectorAll("#cars");
let newRow = tbodyRef[0].insertRow();
return newRow
}
function createTd(el, newTr) {
let newel = document.createElement('td');
let elementid = document.querySelectorAll("td").length
newel.setAttribute('id',elementid);
newel.innerHTML = el
newTr.appendChild(newel);
}
function display(element, total) {
element.forEach(e => {
const newTr = createTr()
createTd(e.optionName, newTr)
createTd(e.price, newTr)
})
const tot = document.querySelector("#totalPrice")
tot.innerHTML = total
}
body {
background-color: black;
color: white;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
#form {
display: flex;
flex-direction: column;
width: 250px;
align-items: center;
}
#choice {
height: 120px;
}
.results {
width: 300px;
border: 2px dotted green;
margin: 10px;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Selection</title>
</head>
<body>
<h1>Car Choice</h1>
<h2>Ready to buy your dream car?</h2>
<div class="select">
<!-- Selection of food or drink -->
<form class="flexColumn" id="form">
<select name="choice" id="choice" multiple="true">
<option value="" name="">--Please choose an option--</option>
<option id="vac" value="vac" name="vac">Built-in Vacuum (€150)</option>
<option value="trunk" name="trunk">Automatic Opening Trunk (€2000)</option>
<option value="seat" name="seat">Massaging Seats (€550)</option>
<option value="night" name="night">Nightvision Dashboard System (€360)</option>
<option value="wifi" name="wifi">WiFi/Entertainment/Navigation (€1200)</option>
<option value="park" name="park">Self-Parking System (€600)</option>
</select>
<button id="submit" class="submit" submit>SUBMIT</button>
</form>
<p>Your current selected options:</p>
<div id="selection" class="selection">
<table class="results" style="width:200px">
<tr>
<th>Option</th>
<th>Price (€)</th>
</tr>
<tbody id="cars">
<tbody>
<tfoot>
<tr>
<td>TOTAL:</td>
<td id="totalPrice"></td>
</tr>
</tfoot>
</table>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
-----------------------
/* See/add options, remove options,
see overview of options and price
*/
// VARIABLES
let button = document.querySelector("#submit");
let choice = document.querySelector("#choice");
// OPTIONS CLASS CONSTRUCTOR
class CarOptions {
constructor(optionName, price) {
this.optionName = optionName;
this.price = price;
}
}
// create 6 options
let option = new CarOptions("", 0);
let vac = new CarOptions("vac", 150);
let trunk = new CarOptions("trunk", 2000);
let seat = new CarOptions("seat", 550);
let night = new CarOptions("night", 360);
let wifi = new CarOptions("wifi", 1200);
let park = new CarOptions("park", 600);
// Array of all objects
let allOptions = [option, vac, trunk, seat, night, wifi, park];
// Array of all object names
let allOptionsName = [option.optionName, vac.optionName, trunk.optionName, seat.optionName, night.optionName, wifi.optionName, park.optionName];
// EVENTS
// On submit event
button.addEventListener("click", (e) => {
e.preventDefault();
const selected = document.querySelectorAll('#choice option:checked');
const values = Array.from(selected).map(el => el.value);
const res = allOptions.filter(a => values.includes(a.optionName))
const total = res.reduce((acc, v) => acc += v.price, 0 )
display(res, total);
})
function createTr() {
let tbodyRef = document.querySelectorAll("#cars");
let newRow = tbodyRef[0].insertRow();
return newRow
}
function createTd(el, newTr) {
let newel = document.createElement('td');
let elementid = document.querySelectorAll("td").length
newel.setAttribute('id',elementid);
newel.innerHTML = el
newTr.appendChild(newel);
}
function display(element, total) {
element.forEach(e => {
const newTr = createTr()
createTd(e.optionName, newTr)
createTd(e.price, newTr)
})
const tot = document.querySelector("#totalPrice")
tot.innerHTML = total
}
body {
background-color: black;
color: white;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
#form {
display: flex;
flex-direction: column;
width: 250px;
align-items: center;
}
#choice {
height: 120px;
}
.results {
width: 300px;
border: 2px dotted green;
margin: 10px;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Selection</title>
</head>
<body>
<h1>Car Choice</h1>
<h2>Ready to buy your dream car?</h2>
<div class="select">
<!-- Selection of food or drink -->
<form class="flexColumn" id="form">
<select name="choice" id="choice" multiple="true">
<option value="" name="">--Please choose an option--</option>
<option id="vac" value="vac" name="vac">Built-in Vacuum (€150)</option>
<option value="trunk" name="trunk">Automatic Opening Trunk (€2000)</option>
<option value="seat" name="seat">Massaging Seats (€550)</option>
<option value="night" name="night">Nightvision Dashboard System (€360)</option>
<option value="wifi" name="wifi">WiFi/Entertainment/Navigation (€1200)</option>
<option value="park" name="park">Self-Parking System (€600)</option>
</select>
<button id="submit" class="submit" submit>SUBMIT</button>
</form>
<p>Your current selected options:</p>
<div id="selection" class="selection">
<table class="results" style="width:200px">
<tr>
<th>Option</th>
<th>Price (€)</th>
</tr>
<tbody id="cars">
<tbody>
<tfoot>
<tr>
<td>TOTAL:</td>
<td id="totalPrice"></td>
</tr>
</tfoot>
</table>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
-----------------------
/* See/add options, remove options,
see overview of options and price
*/
// VARIABLES
let button = document.querySelector("#submit");
let choice = document.querySelector("#choice");
// OPTIONS CLASS CONSTRUCTOR
class CarOptions {
constructor(optionName, price) {
this.optionName = optionName;
this.price = price;
}
}
// create 6 options
let option = new CarOptions("", 0);
let vac = new CarOptions("vac", 150);
let trunk = new CarOptions("trunk", 2000);
let seat = new CarOptions("seat", 550);
let night = new CarOptions("night", 360);
let wifi = new CarOptions("wifi", 1200);
let park = new CarOptions("park", 600);
// Array of all objects
let allOptions = [option, vac, trunk, seat, night, wifi, park];
// Array of all object names
let allOptionsName = [option.optionName, vac.optionName, trunk.optionName, seat.optionName, night.optionName, wifi.optionName, park.optionName];
// EVENTS
// On submit event
button.addEventListener("click", (e) => {
e.preventDefault();
const selected = document.querySelectorAll('#choice option:checked');
const values = Array.from(selected).map(el => el.value);
const res = allOptions.filter(a => values.includes(a.optionName))
const total = res.reduce((acc, v) => acc += v.price, 0 )
display(res, total);
})
function createTr() {
let tbodyRef = document.querySelectorAll("#cars");
let newRow = tbodyRef[0].insertRow();
return newRow
}
function createTd(el, newTr) {
let newel = document.createElement('td');
let elementid = document.querySelectorAll("td").length
newel.setAttribute('id',elementid);
newel.innerHTML = el
newTr.appendChild(newel);
}
function display(element, total) {
element.forEach(e => {
const newTr = createTr()
createTd(e.optionName, newTr)
createTd(e.price, newTr)
})
const tot = document.querySelector("#totalPrice")
tot.innerHTML = total
}
body {
background-color: black;
color: white;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}
#form {
display: flex;
flex-direction: column;
width: 250px;
align-items: center;
}
#choice {
height: 120px;
}
.results {
width: 300px;
border: 2px dotted green;
margin: 10px;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Selection</title>
</head>
<body>
<h1>Car Choice</h1>
<h2>Ready to buy your dream car?</h2>
<div class="select">
<!-- Selection of food or drink -->
<form class="flexColumn" id="form">
<select name="choice" id="choice" multiple="true">
<option value="" name="">--Please choose an option--</option>
<option id="vac" value="vac" name="vac">Built-in Vacuum (€150)</option>
<option value="trunk" name="trunk">Automatic Opening Trunk (€2000)</option>
<option value="seat" name="seat">Massaging Seats (€550)</option>
<option value="night" name="night">Nightvision Dashboard System (€360)</option>
<option value="wifi" name="wifi">WiFi/Entertainment/Navigation (€1200)</option>
<option value="park" name="park">Self-Parking System (€600)</option>
</select>
<button id="submit" class="submit" submit>SUBMIT</button>
</form>
<p>Your current selected options:</p>
<div id="selection" class="selection">
<table class="results" style="width:200px">
<tr>
<th>Option</th>
<th>Price (€)</th>
</tr>
<tbody id="cars">
<tbody>
<tfoot>
<tr>
<td>TOTAL:</td>
<td id="totalPrice"></td>
</tr>
</tfoot>
</table>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
css "tooltips" for both mouse hover & keyboard focus
.set_of_libs span:hover span,
.set_of_libs span:focus-within span {
display: inline;
}
html {
--darkgrey: #333333;
--lightgrey: #cccccc;
--darkblue: #041e42;
--lightblue: #0099ff;
--red: #a50034;
--yellow: #f4aa00;
--pastel: #fff0e8;
--white: #ffffff;
--green: #00A611;
--ff-title: "Poppins", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
--ff-body: -system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", Arial, sans-serif;
font-size: 18px;
font-weight: 400;
line-height: 1.35;
font-family: var(--ff-body);
background: var(--white);
color: var(--darkgrey);
}
*:focus {
outline: 4px solid var(--lightblue) !important;
outline-offset: 3px;
}
.side-padding {
padding-left: 10%;
padding-right: 10%;
}
a,
a:hover,
a:visited {
text-decoration: none;
color: inherit;
border-bottom: 1px dotted #004b6b;
border-radius: 5px;
}
#policy ul {
margin-left: 3rem;
margin-bottom: 1rem;
}
#policy li a,
#policy li a:hover,
#policy li a:visited {
text-decoration: none;
border-bottom: 1px dotted #004b6b;
color: var(--darkblue);
}
#policy li span {
color: var(--darkblue);
}
.set_of_libs {
position: relative;
}
.set_of_libs span span {
display: none;
position: absolute;
border: 1px solid var(--darkblue);
border-radius: 0.5rem;
background-color: var(--darkblue);
color: var(--pastel) !important;
padding: 0.5rem;
transform: translate(-50%, 50%);
z-index: 10;
max-width: 50%;
}
.set_of_libs span:hover span,
.set_of_libs span:focus-within span {
display: inline;
}
<header aria-label="Header section`">
<h1>Obligatory h1 Heading</h1>
</header>
<main id="policy" class="side-padding" aria-label="The Notebooks">
<h2>A main heading</h2>
<section aria-labelledby="standard_notebook_h3">
<h3 id="standard_notebook_h3">Standard Notebook</h3>
<p>Standard Notebook is the default python 3 notebook, with a wide selection of libraries includes.</p>
<ul>
<li class="set_of_libs">
Based on the <span><a href="https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook">jupyter/minimal-notebook</a> <span>(Jupyter's minimal notebook)</span></span> image.
</li>
<li class="set_of_libs">
Includes <span><a href="https://nbgrader.readthedocs.io/en/stable/">nbgrader</a> <span>(A system for assigning and grading Jupyter notebooks)</span></span> and <span><a href="https://github.com/edina/plusGitRepo">+GitRepo</a> <span>(+GitRepo lets your students collect content from a git repository.)</span></span>
tools for document sharing.
</li>
<li class="set_of_libs">
Provide <span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/rubberband/readme.md">rubberband</a> <span>(Multi-Cell selection using a rubberband.)</span></span>,
<span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/exercise/readme.md">exercise</a> <span>(Extension for hiding/showing solutions cells)</span></span>, and
<span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/exercise2/readme.md">exercise-2</a> <span>(Extension for hiding/showing solutions cells)</span></span> extensions.
<strong>Note</strong> these are not related to nbgrader in any way.
</li>
<li class="set_of_libs">
Data Access libraries: <span><a href='https://www.crummy.com/software/BeautifulSoup/bs4/doc/'>beautifulsoup4</a> <span>(Python library designed for screen-scraping - version: 4.9.3)</span></span>, <span><a href='https://pypi.org/project/dill/'>dill</a> <span>(Serialize all of python (almost) - version: 0.3.4)</span></span>,
<span><a href='https://github.com/gitpython-developers/gitdb'>gitdb2</a> <span>(GitDB allows you to access bare git repositories for reading and writing - version: 4.0.2)</span></span>, <span><a href='http://xmlsoft.org/html/index.html'>libxml2</a> <span>(The XML C parser and toolkit of Gnome - version: 2.9.12)</span></span>,
<span><a href='https://lxml.de/'>lxml</a> <span>(Pythonic binding for the C libraries libxml2 and libxslt - version: 4.6.3)</span></span>, <span><a href='https://dev.mysql.com/doc/connector-python/en/'>mysql-connector-python</a> <span>(Enables Python programs to access MySQL databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249) - version: 8.0.25)</span></span>,
<span><a href='https://openpyxl.readthedocs.io/en/stable/'>openpyxl</a> <span>(a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files - version: 3.0.7)</span></span>, <span><a href='https://developers.google.com/protocol-buffers/docs/pythontutorial'>protobuf</a> <span>(Protocol Buffers - Googles data interchange format - version: 3.16.0)</span></span>,
<span><a href='https://github.com/willtrnr/pyxlsb'>pyxlsb</a> <span>(an Excel 2007-2010 Binary Workbook (xlsb) parser for Python - version: 1.0.8)</span></span>, <span><a href='https://docs.sqlalchemy.org/en/13/'>sqlalchemy</a> <span>(Database Abstraction Library - version: 1.4.22)</span></span>,
<span><a href='https://anaconda.org/conda-forge/sqlite'>sqlite</a> <span>(SQLite darabase engine/server - version: 3.35.5)</span></span>, <span><a href='https://textblob.readthedocs.io/en/dev/'>textblob</a> <span>(Simple, Pythonic text processing. Sentiment analysis, part-of-speech tagging, noun phrase parsing, and more - version: 0.15.3)</span></span>,
<span><a href='http://www.unixodbc.org/'>unixodbc</a> <span>(ODBC on non MS Windows platforms - version: 2.3.9)</span></span>, <span><a href='https://xlrd.readthedocs.io/en/latest/'>xlrd</a> <span>(Library for developers to extract data from Microsoft Excel (tm) spreadsheet files - version: 2.0.1)</span></span>,
<span><a href='https://xlwt.readthedocs.io/en/latest/'>xlwt</a> <span>(a library for developers to use to generate spreadsheet files compatible with Microsoft Excel versions 95 to 2003 - version: 1.3.0)</span></span>, <span><a href='https://xlsxwriter.readthedocs.io/'>xlsxwriter</a> <span>(a Python module for creating Excel XLSX files - version: 1.4.4)</span></span>,
and <span><a href='https://xmlschema.readthedocs.io/en/latest/'>xmlschema</a> <span>(An implementation of XML Schema for Python - version: 1.6.4)</span></span>
</li>
<li>
Data Visualization tools: <a href='https://docs.bokeh.org/en/latest/docs/user_guide.html' title='Interactive Web Plotting for Python - version: 2.3.3'>bokeh</a>, <a href='https://graphviz.gitlab.io/documentation/' title='creation and rendering of graph descriptions in the DOT language of the Graphviz graph drawing software - version: 2.48.0'>graphviz</a>,
<a href='https://hvplot.holoviz.org/' title='0.7.3'>hvplot</a>, <a href='https://ipywidgets.readthedocs.io/en/latest/' title='Jupyter interactive widgets - version: 7.6.3'>ipywidgets</a>, <a href='https://github.com/matplotlib/ipympl' title='Matplotlib Jupyter Extension - version: 0.7.0'>ipympl</a>,
<a href='https://github.com/K3D-tools/K3D-jupyter' title='K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc) - version: 2.9.7'>k3d</a>,
<a href='https://matplotlib.org/contents.html' title='Publication quality features in Python - version: 3.4.2'>matplotlib-base</a>, <a href='https://mpld3.github.io/' title='D3 Viewer for matplotlib - version: 0.5.5'>mpld3</a>, <a href='https://jiffyclub.github.io/palettable/'
title='Palettable (formerly brewer2mpl) is a library of color palettes for Python - version: 3.3.0'>palettable</a>, <a href='https://plotly.com/python/' title='An interactive, browser-based graphing library for Python - version: 5.1.0'>plotly</a>,
<a href='https://geostat-framework.readthedocs.io/projects/pykrige/en/stable/' title='Supports 2D and 3D ordinary and universal kriging - version: 1.6.0'>pykrige</a>, <a href='https://docs.pymc.io/' title='PyMC3 allows you to write down models using an intuitive syntax to describe a data generating process - version: 3.11.2'>pymc3</a>,
<a href='https://seaborn.pydata.org/' title='Statistical data visualization - version: 0.11.1'>seaborn</a>, <a href='https://pypi.org/project/widgetsnbextension/' title='Interactive HTML Widgets for Jupyter - version: 3.5.1'>widgetsnbextension</a>,
and <a href='http://amueller.github.io/word_cloud/' title='A little word cloud generator in Python - version: 1.8.1'>wordcloud</a>
</li>
</ul>
</section>
</main>
-----------------------
.set_of_libs span:hover span,
.set_of_libs span:focus-within span {
display: inline;
}
html {
--darkgrey: #333333;
--lightgrey: #cccccc;
--darkblue: #041e42;
--lightblue: #0099ff;
--red: #a50034;
--yellow: #f4aa00;
--pastel: #fff0e8;
--white: #ffffff;
--green: #00A611;
--ff-title: "Poppins", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
--ff-body: -system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", Arial, sans-serif;
font-size: 18px;
font-weight: 400;
line-height: 1.35;
font-family: var(--ff-body);
background: var(--white);
color: var(--darkgrey);
}
*:focus {
outline: 4px solid var(--lightblue) !important;
outline-offset: 3px;
}
.side-padding {
padding-left: 10%;
padding-right: 10%;
}
a,
a:hover,
a:visited {
text-decoration: none;
color: inherit;
border-bottom: 1px dotted #004b6b;
border-radius: 5px;
}
#policy ul {
margin-left: 3rem;
margin-bottom: 1rem;
}
#policy li a,
#policy li a:hover,
#policy li a:visited {
text-decoration: none;
border-bottom: 1px dotted #004b6b;
color: var(--darkblue);
}
#policy li span {
color: var(--darkblue);
}
.set_of_libs {
position: relative;
}
.set_of_libs span span {
display: none;
position: absolute;
border: 1px solid var(--darkblue);
border-radius: 0.5rem;
background-color: var(--darkblue);
color: var(--pastel) !important;
padding: 0.5rem;
transform: translate(-50%, 50%);
z-index: 10;
max-width: 50%;
}
.set_of_libs span:hover span,
.set_of_libs span:focus-within span {
display: inline;
}
<header aria-label="Header section`">
<h1>Obligatory h1 Heading</h1>
</header>
<main id="policy" class="side-padding" aria-label="The Notebooks">
<h2>A main heading</h2>
<section aria-labelledby="standard_notebook_h3">
<h3 id="standard_notebook_h3">Standard Notebook</h3>
<p>Standard Notebook is the default python 3 notebook, with a wide selection of libraries includes.</p>
<ul>
<li class="set_of_libs">
Based on the <span><a href="https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook">jupyter/minimal-notebook</a> <span>(Jupyter's minimal notebook)</span></span> image.
</li>
<li class="set_of_libs">
Includes <span><a href="https://nbgrader.readthedocs.io/en/stable/">nbgrader</a> <span>(A system for assigning and grading Jupyter notebooks)</span></span> and <span><a href="https://github.com/edina/plusGitRepo">+GitRepo</a> <span>(+GitRepo lets your students collect content from a git repository.)</span></span>
tools for document sharing.
</li>
<li class="set_of_libs">
Provide <span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/rubberband/readme.md">rubberband</a> <span>(Multi-Cell selection using a rubberband.)</span></span>,
<span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/exercise/readme.md">exercise</a> <span>(Extension for hiding/showing solutions cells)</span></span>, and
<span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/exercise2/readme.md">exercise-2</a> <span>(Extension for hiding/showing solutions cells)</span></span> extensions.
<strong>Note</strong> these are not related to nbgrader in any way.
</li>
<li class="set_of_libs">
Data Access libraries: <span><a href='https://www.crummy.com/software/BeautifulSoup/bs4/doc/'>beautifulsoup4</a> <span>(Python library designed for screen-scraping - version: 4.9.3)</span></span>, <span><a href='https://pypi.org/project/dill/'>dill</a> <span>(Serialize all of python (almost) - version: 0.3.4)</span></span>,
<span><a href='https://github.com/gitpython-developers/gitdb'>gitdb2</a> <span>(GitDB allows you to access bare git repositories for reading and writing - version: 4.0.2)</span></span>, <span><a href='http://xmlsoft.org/html/index.html'>libxml2</a> <span>(The XML C parser and toolkit of Gnome - version: 2.9.12)</span></span>,
<span><a href='https://lxml.de/'>lxml</a> <span>(Pythonic binding for the C libraries libxml2 and libxslt - version: 4.6.3)</span></span>, <span><a href='https://dev.mysql.com/doc/connector-python/en/'>mysql-connector-python</a> <span>(Enables Python programs to access MySQL databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249) - version: 8.0.25)</span></span>,
<span><a href='https://openpyxl.readthedocs.io/en/stable/'>openpyxl</a> <span>(a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files - version: 3.0.7)</span></span>, <span><a href='https://developers.google.com/protocol-buffers/docs/pythontutorial'>protobuf</a> <span>(Protocol Buffers - Googles data interchange format - version: 3.16.0)</span></span>,
<span><a href='https://github.com/willtrnr/pyxlsb'>pyxlsb</a> <span>(an Excel 2007-2010 Binary Workbook (xlsb) parser for Python - version: 1.0.8)</span></span>, <span><a href='https://docs.sqlalchemy.org/en/13/'>sqlalchemy</a> <span>(Database Abstraction Library - version: 1.4.22)</span></span>,
<span><a href='https://anaconda.org/conda-forge/sqlite'>sqlite</a> <span>(SQLite darabase engine/server - version: 3.35.5)</span></span>, <span><a href='https://textblob.readthedocs.io/en/dev/'>textblob</a> <span>(Simple, Pythonic text processing. Sentiment analysis, part-of-speech tagging, noun phrase parsing, and more - version: 0.15.3)</span></span>,
<span><a href='http://www.unixodbc.org/'>unixodbc</a> <span>(ODBC on non MS Windows platforms - version: 2.3.9)</span></span>, <span><a href='https://xlrd.readthedocs.io/en/latest/'>xlrd</a> <span>(Library for developers to extract data from Microsoft Excel (tm) spreadsheet files - version: 2.0.1)</span></span>,
<span><a href='https://xlwt.readthedocs.io/en/latest/'>xlwt</a> <span>(a library for developers to use to generate spreadsheet files compatible with Microsoft Excel versions 95 to 2003 - version: 1.3.0)</span></span>, <span><a href='https://xlsxwriter.readthedocs.io/'>xlsxwriter</a> <span>(a Python module for creating Excel XLSX files - version: 1.4.4)</span></span>,
and <span><a href='https://xmlschema.readthedocs.io/en/latest/'>xmlschema</a> <span>(An implementation of XML Schema for Python - version: 1.6.4)</span></span>
</li>
<li>
Data Visualization tools: <a href='https://docs.bokeh.org/en/latest/docs/user_guide.html' title='Interactive Web Plotting for Python - version: 2.3.3'>bokeh</a>, <a href='https://graphviz.gitlab.io/documentation/' title='creation and rendering of graph descriptions in the DOT language of the Graphviz graph drawing software - version: 2.48.0'>graphviz</a>,
<a href='https://hvplot.holoviz.org/' title='0.7.3'>hvplot</a>, <a href='https://ipywidgets.readthedocs.io/en/latest/' title='Jupyter interactive widgets - version: 7.6.3'>ipywidgets</a>, <a href='https://github.com/matplotlib/ipympl' title='Matplotlib Jupyter Extension - version: 0.7.0'>ipympl</a>,
<a href='https://github.com/K3D-tools/K3D-jupyter' title='K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc) - version: 2.9.7'>k3d</a>,
<a href='https://matplotlib.org/contents.html' title='Publication quality features in Python - version: 3.4.2'>matplotlib-base</a>, <a href='https://mpld3.github.io/' title='D3 Viewer for matplotlib - version: 0.5.5'>mpld3</a>, <a href='https://jiffyclub.github.io/palettable/'
title='Palettable (formerly brewer2mpl) is a library of color palettes for Python - version: 3.3.0'>palettable</a>, <a href='https://plotly.com/python/' title='An interactive, browser-based graphing library for Python - version: 5.1.0'>plotly</a>,
<a href='https://geostat-framework.readthedocs.io/projects/pykrige/en/stable/' title='Supports 2D and 3D ordinary and universal kriging - version: 1.6.0'>pykrige</a>, <a href='https://docs.pymc.io/' title='PyMC3 allows you to write down models using an intuitive syntax to describe a data generating process - version: 3.11.2'>pymc3</a>,
<a href='https://seaborn.pydata.org/' title='Statistical data visualization - version: 0.11.1'>seaborn</a>, <a href='https://pypi.org/project/widgetsnbextension/' title='Interactive HTML Widgets for Jupyter - version: 3.5.1'>widgetsnbextension</a>,
and <a href='http://amueller.github.io/word_cloud/' title='A little word cloud generator in Python - version: 1.8.1'>wordcloud</a>
</li>
</ul>
</section>
</main>
-----------------------
.set_of_libs span:hover span,
.set_of_libs span:focus-within span {
display: inline;
}
html {
--darkgrey: #333333;
--lightgrey: #cccccc;
--darkblue: #041e42;
--lightblue: #0099ff;
--red: #a50034;
--yellow: #f4aa00;
--pastel: #fff0e8;
--white: #ffffff;
--green: #00A611;
--ff-title: "Poppins", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
--ff-body: -system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", Arial, sans-serif;
font-size: 18px;
font-weight: 400;
line-height: 1.35;
font-family: var(--ff-body);
background: var(--white);
color: var(--darkgrey);
}
*:focus {
outline: 4px solid var(--lightblue) !important;
outline-offset: 3px;
}
.side-padding {
padding-left: 10%;
padding-right: 10%;
}
a,
a:hover,
a:visited {
text-decoration: none;
color: inherit;
border-bottom: 1px dotted #004b6b;
border-radius: 5px;
}
#policy ul {
margin-left: 3rem;
margin-bottom: 1rem;
}
#policy li a,
#policy li a:hover,
#policy li a:visited {
text-decoration: none;
border-bottom: 1px dotted #004b6b;
color: var(--darkblue);
}
#policy li span {
color: var(--darkblue);
}
.set_of_libs {
position: relative;
}
.set_of_libs span span {
display: none;
position: absolute;
border: 1px solid var(--darkblue);
border-radius: 0.5rem;
background-color: var(--darkblue);
color: var(--pastel) !important;
padding: 0.5rem;
transform: translate(-50%, 50%);
z-index: 10;
max-width: 50%;
}
.set_of_libs span:hover span,
.set_of_libs span:focus-within span {
display: inline;
}
<header aria-label="Header section`">
<h1>Obligatory h1 Heading</h1>
</header>
<main id="policy" class="side-padding" aria-label="The Notebooks">
<h2>A main heading</h2>
<section aria-labelledby="standard_notebook_h3">
<h3 id="standard_notebook_h3">Standard Notebook</h3>
<p>Standard Notebook is the default python 3 notebook, with a wide selection of libraries includes.</p>
<ul>
<li class="set_of_libs">
Based on the <span><a href="https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook">jupyter/minimal-notebook</a> <span>(Jupyter's minimal notebook)</span></span> image.
</li>
<li class="set_of_libs">
Includes <span><a href="https://nbgrader.readthedocs.io/en/stable/">nbgrader</a> <span>(A system for assigning and grading Jupyter notebooks)</span></span> and <span><a href="https://github.com/edina/plusGitRepo">+GitRepo</a> <span>(+GitRepo lets your students collect content from a git repository.)</span></span>
tools for document sharing.
</li>
<li class="set_of_libs">
Provide <span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/rubberband/readme.md">rubberband</a> <span>(Multi-Cell selection using a rubberband.)</span></span>,
<span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/exercise/readme.md">exercise</a> <span>(Extension for hiding/showing solutions cells)</span></span>, and
<span><a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/exercise2/readme.md">exercise-2</a> <span>(Extension for hiding/showing solutions cells)</span></span> extensions.
<strong>Note</strong> these are not related to nbgrader in any way.
</li>
<li class="set_of_libs">
Data Access libraries: <span><a href='https://www.crummy.com/software/BeautifulSoup/bs4/doc/'>beautifulsoup4</a> <span>(Python library designed for screen-scraping - version: 4.9.3)</span></span>, <span><a href='https://pypi.org/project/dill/'>dill</a> <span>(Serialize all of python (almost) - version: 0.3.4)</span></span>,
<span><a href='https://github.com/gitpython-developers/gitdb'>gitdb2</a> <span>(GitDB allows you to access bare git repositories for reading and writing - version: 4.0.2)</span></span>, <span><a href='http://xmlsoft.org/html/index.html'>libxml2</a> <span>(The XML C parser and toolkit of Gnome - version: 2.9.12)</span></span>,
<span><a href='https://lxml.de/'>lxml</a> <span>(Pythonic binding for the C libraries libxml2 and libxslt - version: 4.6.3)</span></span>, <span><a href='https://dev.mysql.com/doc/connector-python/en/'>mysql-connector-python</a> <span>(Enables Python programs to access MySQL databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249) - version: 8.0.25)</span></span>,
<span><a href='https://openpyxl.readthedocs.io/en/stable/'>openpyxl</a> <span>(a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files - version: 3.0.7)</span></span>, <span><a href='https://developers.google.com/protocol-buffers/docs/pythontutorial'>protobuf</a> <span>(Protocol Buffers - Googles data interchange format - version: 3.16.0)</span></span>,
<span><a href='https://github.com/willtrnr/pyxlsb'>pyxlsb</a> <span>(an Excel 2007-2010 Binary Workbook (xlsb) parser for Python - version: 1.0.8)</span></span>, <span><a href='https://docs.sqlalchemy.org/en/13/'>sqlalchemy</a> <span>(Database Abstraction Library - version: 1.4.22)</span></span>,
<span><a href='https://anaconda.org/conda-forge/sqlite'>sqlite</a> <span>(SQLite darabase engine/server - version: 3.35.5)</span></span>, <span><a href='https://textblob.readthedocs.io/en/dev/'>textblob</a> <span>(Simple, Pythonic text processing. Sentiment analysis, part-of-speech tagging, noun phrase parsing, and more - version: 0.15.3)</span></span>,
<span><a href='http://www.unixodbc.org/'>unixodbc</a> <span>(ODBC on non MS Windows platforms - version: 2.3.9)</span></span>, <span><a href='https://xlrd.readthedocs.io/en/latest/'>xlrd</a> <span>(Library for developers to extract data from Microsoft Excel (tm) spreadsheet files - version: 2.0.1)</span></span>,
<span><a href='https://xlwt.readthedocs.io/en/latest/'>xlwt</a> <span>(a library for developers to use to generate spreadsheet files compatible with Microsoft Excel versions 95 to 2003 - version: 1.3.0)</span></span>, <span><a href='https://xlsxwriter.readthedocs.io/'>xlsxwriter</a> <span>(a Python module for creating Excel XLSX files - version: 1.4.4)</span></span>,
and <span><a href='https://xmlschema.readthedocs.io/en/latest/'>xmlschema</a> <span>(An implementation of XML Schema for Python - version: 1.6.4)</span></span>
</li>
<li>
Data Visualization tools: <a href='https://docs.bokeh.org/en/latest/docs/user_guide.html' title='Interactive Web Plotting for Python - version: 2.3.3'>bokeh</a>, <a href='https://graphviz.gitlab.io/documentation/' title='creation and rendering of graph descriptions in the DOT language of the Graphviz graph drawing software - version: 2.48.0'>graphviz</a>,
<a href='https://hvplot.holoviz.org/' title='0.7.3'>hvplot</a>, <a href='https://ipywidgets.readthedocs.io/en/latest/' title='Jupyter interactive widgets - version: 7.6.3'>ipywidgets</a>, <a href='https://github.com/matplotlib/ipympl' title='Matplotlib Jupyter Extension - version: 0.7.0'>ipympl</a>,
<a href='https://github.com/K3D-tools/K3D-jupyter' title='K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc) - version: 2.9.7'>k3d</a>,
<a href='https://matplotlib.org/contents.html' title='Publication quality features in Python - version: 3.4.2'>matplotlib-base</a>, <a href='https://mpld3.github.io/' title='D3 Viewer for matplotlib - version: 0.5.5'>mpld3</a>, <a href='https://jiffyclub.github.io/palettable/'
title='Palettable (formerly brewer2mpl) is a library of color palettes for Python - version: 3.3.0'>palettable</a>, <a href='https://plotly.com/python/' title='An interactive, browser-based graphing library for Python - version: 5.1.0'>plotly</a>,
<a href='https://geostat-framework.readthedocs.io/projects/pykrige/en/stable/' title='Supports 2D and 3D ordinary and universal kriging - version: 1.6.0'>pykrige</a>, <a href='https://docs.pymc.io/' title='PyMC3 allows you to write down models using an intuitive syntax to describe a data generating process - version: 3.11.2'>pymc3</a>,
<a href='https://seaborn.pydata.org/' title='Statistical data visualization - version: 0.11.1'>seaborn</a>, <a href='https://pypi.org/project/widgetsnbextension/' title='Interactive HTML Widgets for Jupyter - version: 3.5.1'>widgetsnbextension</a>,
and <a href='http://amueller.github.io/word_cloud/' title='A little word cloud generator in Python - version: 1.8.1'>wordcloud</a>
</li>
</ul>
</section>
</main>
How can I toggle back and forth to Two Different CountDown Timer using JS
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let birthday = true;
let processed_date = nextBirthday;
...
function countdown() {
const newYearsDate = new Date(processed_date);
...
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my birthday' : 'new year';
birthday = !birthday;
});
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let processed_date = nextBirthday;
let birthday = true;
const daysEl = document.getElementById("days");
const hoursEl = document.getElementById("hours");
const minsEl = document.getElementById("minutes");
const secsEl = document.getElementById("seconds");
const heading = document.querySelector('h1');
const toggle_button = document.querySelector("button");
function countdown() {
const newYearsDate = new Date(processed_date);
const currentDate = new Date();
const totalSeconds = (newYearsDate - currentDate) / 1000;
const days = Math.floor(totalSeconds / 3600 / 24);
const hours = Math.floor(totalSeconds / 3600) % 24;
const minutes = Math.floor(totalSeconds / 60) % 60;
const seconds = Math.floor(totalSeconds) % 60;
daysEl.innerHTML = days;
hoursEl.innerHTML = formate(hours);
minsEl.innerHTML = formate(minutes);
secsEl.innerHTML = formate(seconds);
}
function formate(time) {
if (time < 10) {
return (`0${time}`);
} else {
return time
}
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my next birthday' : 'new year';
birthday = !birthday;
countdown(); //not necessary - only for imidiate change instead of waiting 1 second
});
countdown();
setInterval(countdown, 1000);
* {
box-sizing: border-box;
text-transform: capitalize;
font-size: 10px;
}
body {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
h1 {
font-weight: normal;
font-size: 2.5rem;
}
.countdown-container {
display: flex;
}
.big-text {
font-weight: bold;
font-size: 4rem;
line-height: 1;
margin: 0 1.5rem;
}
.countdown-el {
text-align: center;
}
.countdown-el span {
font-size: 0.8rem;
}
.button {
top: 2rem;
display: inline-block;
border: 0;
outline: 0;
padding: 12px 16px;
line-height: 1.4;
background: linear-gradient(#4d4d4d, #2f2f2f);
border-radius: 5px;
border: 1px solid black;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
color: white !important;
font-size: 1.2em;
cursor: pointer;
/* Important part */
position: relative;
transition: padding-right 0.3s ease-out;
}
span {
font-size: inherit;
}
<h1>Time left To <span>My next Birthday</span></h1>
<div class="countdown-container">
<div class="countdown-el days-c">
<p class="big-text" id="days">0</p>
<span>days</span>
</div>
<div class="countdown-el hours-c">
<p class="big-text" id="hours">0</p>
<span>hours</span>
</div>
<div class="countdown-el mins-c">
<p class="big-text" id="minutes">0</p>
<span>minutes</span>
</div>
<div class="countdown-el sec-c">
<p class="big-text" id="seconds">0</p>
<span>seconds</span>
</div>
</div>
<button class="button">Time left to <span>new year</span></button>
-----------------------
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let birthday = true;
let processed_date = nextBirthday;
...
function countdown() {
const newYearsDate = new Date(processed_date);
...
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my birthday' : 'new year';
birthday = !birthday;
});
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let processed_date = nextBirthday;
let birthday = true;
const daysEl = document.getElementById("days");
const hoursEl = document.getElementById("hours");
const minsEl = document.getElementById("minutes");
const secsEl = document.getElementById("seconds");
const heading = document.querySelector('h1');
const toggle_button = document.querySelector("button");
function countdown() {
const newYearsDate = new Date(processed_date);
const currentDate = new Date();
const totalSeconds = (newYearsDate - currentDate) / 1000;
const days = Math.floor(totalSeconds / 3600 / 24);
const hours = Math.floor(totalSeconds / 3600) % 24;
const minutes = Math.floor(totalSeconds / 60) % 60;
const seconds = Math.floor(totalSeconds) % 60;
daysEl.innerHTML = days;
hoursEl.innerHTML = formate(hours);
minsEl.innerHTML = formate(minutes);
secsEl.innerHTML = formate(seconds);
}
function formate(time) {
if (time < 10) {
return (`0${time}`);
} else {
return time
}
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my next birthday' : 'new year';
birthday = !birthday;
countdown(); //not necessary - only for imidiate change instead of waiting 1 second
});
countdown();
setInterval(countdown, 1000);
* {
box-sizing: border-box;
text-transform: capitalize;
font-size: 10px;
}
body {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
h1 {
font-weight: normal;
font-size: 2.5rem;
}
.countdown-container {
display: flex;
}
.big-text {
font-weight: bold;
font-size: 4rem;
line-height: 1;
margin: 0 1.5rem;
}
.countdown-el {
text-align: center;
}
.countdown-el span {
font-size: 0.8rem;
}
.button {
top: 2rem;
display: inline-block;
border: 0;
outline: 0;
padding: 12px 16px;
line-height: 1.4;
background: linear-gradient(#4d4d4d, #2f2f2f);
border-radius: 5px;
border: 1px solid black;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
color: white !important;
font-size: 1.2em;
cursor: pointer;
/* Important part */
position: relative;
transition: padding-right 0.3s ease-out;
}
span {
font-size: inherit;
}
<h1>Time left To <span>My next Birthday</span></h1>
<div class="countdown-container">
<div class="countdown-el days-c">
<p class="big-text" id="days">0</p>
<span>days</span>
</div>
<div class="countdown-el hours-c">
<p class="big-text" id="hours">0</p>
<span>hours</span>
</div>
<div class="countdown-el mins-c">
<p class="big-text" id="minutes">0</p>
<span>minutes</span>
</div>
<div class="countdown-el sec-c">
<p class="big-text" id="seconds">0</p>
<span>seconds</span>
</div>
</div>
<button class="button">Time left to <span>new year</span></button>
-----------------------
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let birthday = true;
let processed_date = nextBirthday;
...
function countdown() {
const newYearsDate = new Date(processed_date);
...
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my birthday' : 'new year';
birthday = !birthday;
});
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let processed_date = nextBirthday;
let birthday = true;
const daysEl = document.getElementById("days");
const hoursEl = document.getElementById("hours");
const minsEl = document.getElementById("minutes");
const secsEl = document.getElementById("seconds");
const heading = document.querySelector('h1');
const toggle_button = document.querySelector("button");
function countdown() {
const newYearsDate = new Date(processed_date);
const currentDate = new Date();
const totalSeconds = (newYearsDate - currentDate) / 1000;
const days = Math.floor(totalSeconds / 3600 / 24);
const hours = Math.floor(totalSeconds / 3600) % 24;
const minutes = Math.floor(totalSeconds / 60) % 60;
const seconds = Math.floor(totalSeconds) % 60;
daysEl.innerHTML = days;
hoursEl.innerHTML = formate(hours);
minsEl.innerHTML = formate(minutes);
secsEl.innerHTML = formate(seconds);
}
function formate(time) {
if (time < 10) {
return (`0${time}`);
} else {
return time
}
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my next birthday' : 'new year';
birthday = !birthday;
countdown(); //not necessary - only for imidiate change instead of waiting 1 second
});
countdown();
setInterval(countdown, 1000);
* {
box-sizing: border-box;
text-transform: capitalize;
font-size: 10px;
}
body {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
h1 {
font-weight: normal;
font-size: 2.5rem;
}
.countdown-container {
display: flex;
}
.big-text {
font-weight: bold;
font-size: 4rem;
line-height: 1;
margin: 0 1.5rem;
}
.countdown-el {
text-align: center;
}
.countdown-el span {
font-size: 0.8rem;
}
.button {
top: 2rem;
display: inline-block;
border: 0;
outline: 0;
padding: 12px 16px;
line-height: 1.4;
background: linear-gradient(#4d4d4d, #2f2f2f);
border-radius: 5px;
border: 1px solid black;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
color: white !important;
font-size: 1.2em;
cursor: pointer;
/* Important part */
position: relative;
transition: padding-right 0.3s ease-out;
}
span {
font-size: inherit;
}
<h1>Time left To <span>My next Birthday</span></h1>
<div class="countdown-container">
<div class="countdown-el days-c">
<p class="big-text" id="days">0</p>
<span>days</span>
</div>
<div class="countdown-el hours-c">
<p class="big-text" id="hours">0</p>
<span>hours</span>
</div>
<div class="countdown-el mins-c">
<p class="big-text" id="minutes">0</p>
<span>minutes</span>
</div>
<div class="countdown-el sec-c">
<p class="big-text" id="seconds">0</p>
<span>seconds</span>
</div>
</div>
<button class="button">Time left to <span>new year</span></button>
-----------------------
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let birthday = true;
let processed_date = nextBirthday;
...
function countdown() {
const newYearsDate = new Date(processed_date);
...
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my birthday' : 'new year';
birthday = !birthday;
});
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let processed_date = nextBirthday;
let birthday = true;
const daysEl = document.getElementById("days");
const hoursEl = document.getElementById("hours");
const minsEl = document.getElementById("minutes");
const secsEl = document.getElementById("seconds");
const heading = document.querySelector('h1');
const toggle_button = document.querySelector("button");
function countdown() {
const newYearsDate = new Date(processed_date);
const currentDate = new Date();
const totalSeconds = (newYearsDate - currentDate) / 1000;
const days = Math.floor(totalSeconds / 3600 / 24);
const hours = Math.floor(totalSeconds / 3600) % 24;
const minutes = Math.floor(totalSeconds / 60) % 60;
const seconds = Math.floor(totalSeconds) % 60;
daysEl.innerHTML = days;
hoursEl.innerHTML = formate(hours);
minsEl.innerHTML = formate(minutes);
secsEl.innerHTML = formate(seconds);
}
function formate(time) {
if (time < 10) {
return (`0${time}`);
} else {
return time
}
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my next birthday' : 'new year';
birthday = !birthday;
countdown(); //not necessary - only for imidiate change instead of waiting 1 second
});
countdown();
setInterval(countdown, 1000);
* {
box-sizing: border-box;
text-transform: capitalize;
font-size: 10px;
}
body {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
h1 {
font-weight: normal;
font-size: 2.5rem;
}
.countdown-container {
display: flex;
}
.big-text {
font-weight: bold;
font-size: 4rem;
line-height: 1;
margin: 0 1.5rem;
}
.countdown-el {
text-align: center;
}
.countdown-el span {
font-size: 0.8rem;
}
.button {
top: 2rem;
display: inline-block;
border: 0;
outline: 0;
padding: 12px 16px;
line-height: 1.4;
background: linear-gradient(#4d4d4d, #2f2f2f);
border-radius: 5px;
border: 1px solid black;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
color: white !important;
font-size: 1.2em;
cursor: pointer;
/* Important part */
position: relative;
transition: padding-right 0.3s ease-out;
}
span {
font-size: inherit;
}
<h1>Time left To <span>My next Birthday</span></h1>
<div class="countdown-container">
<div class="countdown-el days-c">
<p class="big-text" id="days">0</p>
<span>days</span>
</div>
<div class="countdown-el hours-c">
<p class="big-text" id="hours">0</p>
<span>hours</span>
</div>
<div class="countdown-el mins-c">
<p class="big-text" id="minutes">0</p>
<span>minutes</span>
</div>
<div class="countdown-el sec-c">
<p class="big-text" id="seconds">0</p>
<span>seconds</span>
</div>
</div>
<button class="button">Time left to <span>new year</span></button>
-----------------------
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let birthday = true;
let processed_date = nextBirthday;
...
function countdown() {
const newYearsDate = new Date(processed_date);
...
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my birthday' : 'new year';
birthday = !birthday;
});
const nextBirthday = "18 Aug 2022";
const newYear = "01 Jan 2022";
let processed_date = nextBirthday;
let birthday = true;
const daysEl = document.getElementById("days");
const hoursEl = document.getElementById("hours");
const minsEl = document.getElementById("minutes");
const secsEl = document.getElementById("seconds");
const heading = document.querySelector('h1');
const toggle_button = document.querySelector("button");
function countdown() {
const newYearsDate = new Date(processed_date);
const currentDate = new Date();
const totalSeconds = (newYearsDate - currentDate) / 1000;
const days = Math.floor(totalSeconds / 3600 / 24);
const hours = Math.floor(totalSeconds / 3600) % 24;
const minutes = Math.floor(totalSeconds / 60) % 60;
const seconds = Math.floor(totalSeconds) % 60;
daysEl.innerHTML = days;
hoursEl.innerHTML = formate(hours);
minsEl.innerHTML = formate(minutes);
secsEl.innerHTML = formate(seconds);
}
function formate(time) {
if (time < 10) {
return (`0${time}`);
} else {
return time
}
}
toggle_button.addEventListener('click', function() {
processed_date = birthday ? newYear : nextBirthday;
heading.querySelector('span').textContent = birthday ? 'new year' : 'my next birthday';
toggle_button.querySelector('span').textContent = birthday ? 'my next birthday' : 'new year';
birthday = !birthday;
countdown(); //not necessary - only for imidiate change instead of waiting 1 second
});
countdown();
setInterval(countdown, 1000);
* {
box-sizing: border-box;
text-transform: capitalize;
font-size: 10px;
}
body {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
h1 {
font-weight: normal;
font-size: 2.5rem;
}
.countdown-container {
display: flex;
}
.big-text {
font-weight: bold;
font-size: 4rem;
line-height: 1;
margin: 0 1.5rem;
}
.countdown-el {
text-align: center;
}
.countdown-el span {
font-size: 0.8rem;
}
.button {
top: 2rem;
display: inline-block;
border: 0;
outline: 0;
padding: 12px 16px;
line-height: 1.4;
background: linear-gradient(#4d4d4d, #2f2f2f);
border-radius: 5px;
border: 1px solid black;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
color: white !important;
font-size: 1.2em;
cursor: pointer;
/* Important part */
position: relative;
transition: padding-right 0.3s ease-out;
}
span {
font-size: inherit;
}
<h1>Time left To <span>My next Birthday</span></h1>
<div class="countdown-container">
<div class="countdown-el days-c">
<p class="big-text" id="days">0</p>
<span>days</span>
</div>
<div class="countdown-el hours-c">
<p class="big-text" id="hours">0</p>
<span>hours</span>
</div>
<div class="countdown-el mins-c">
<p class="big-text" id="minutes">0</p>
<span>minutes</span>
</div>
<div class="countdown-el sec-c">
<p class="big-text" id="seconds">0</p>
<span>seconds</span>
</div>
</div>
<button class="button">Time left to <span>new year</span></button>
QUESTION
My dynamically generated text is appearing vertically - JS, CSS, HTML
Asked 2022-Apr-04 at 10:51I am creating a clicker engine. Essentially the goal is to have a product where people can easily create a basic clicker game with upgrades. I am using classes to achieve this an I am fairly inexperienced with JS and HTML.
In my code it should be able to create the buttons and values (currently unchanging) easily. The buttons should go down and the values should be arranged horizontally however the values are appearing the wrong way.
Please not that the cat, dog, and horse variables are simply placeholders and will be changed however the code must not depend on there being X buttons.
Thanks in advance!
Here is my code:
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
cat = new item("cat", 5, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
horse = new item("horse", 2, 1, 1, "https://pngimg.com/uploads/buttons/buttons_PNG51.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
ANSWER
Answered 2022-Mar-25 at 14:45the values should be arranged horizontally however the values are appearing the wrong way.
dog = new item("dog", 10, 1, 1, "button.png");
cat = new item("cat", 5, 1, 1, "button.png");
horse = new item("horse", 2, 1, 1, "button.png");
10, 1, 1
5, 1, 1,
2, 1, 1
While I couldn't quite understand why, the values are presented from top to bottom, instead of your intended from left to right. To fix that the simplest way is to switch the values to the "right" places according to their presentation, as the following:
10, 5, 2
1, 1, 1
1, 1, 1
Or as it'll look in the code:
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
class item{
constructor(name, value, pc, ps, src) {
this.value = value;
this.pc = pc;
this.ps = ps;
console.log(name);
this.id = name;
this.src = src;
document.getElementById("banner").innerHTML = document.getElementById('banner').innerHTML+"<div id="+this.id+"><p>"+this.id+"</p><p id=value>"+this.value+"</p><p>"+this.id.charAt(0)+"pc</p><p id="+this.id.charAt(0)+"pc>"+this.pc+"</p><p>"+this.id.charAt(0)+"ps</p><p id="+this.id.charAt(0)+"ps>"+this.ps+"</p></div>";
document.getElementById("clicks").innerHTML = document.getElementById("clicks").innerHTML + "<img src="+this.src+" alt='"+this.id+". A clickable button. This image could not be loaded' id="+this.id+"Button class=button onclick='"+this.id+".click()'></img>"
//setInterval(this.tick, 1000);
}
click(){
this.value = this.value + this.pc;
console.log(this.value);
}
tick(){
this.value = this.value + this.ps;
console.log(this.value);
};
}
dog = new item("dog", 10, 5, 2, "button.png");
cat = new item("cat", 1, 1, 1, "button.png");
horse = new item("horse", 1, 1, 1, "button.png");
h1{
color: white;
margin:2mm;
}
body{
background: #0f0f0f;
font-family: Courier New, Lucida Console, monospace;
margin:0;
color: white;
}
.banner{
background: #363636;
margin-top:0;
margin-left:0;
margin-bottom:0;
margin-right:0;
display: flex;
flex-direction: row;
justify-content: center;
}
.banner > *{
padding-left:0.5mm;
padding-right:0.5mm;
}
.button{
width: 40mm;
height: 40mm;
background: red;
}
.pannel{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clicker Engine V2</title>
</head>
<body>
<div id=clicks class=pannel><div id=banner class=banner></div></div>
</body>
</html>
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit