compair navbar href to iframe href - iframe

I am trying to compair the navbar href to my iframe href, in order to determine which navbar li is active. A helping hand would be greatly appreciated as it does not currently work.
I tried the following javascript on this domain: development.beeldenfabriek.nl/viewer. This domain has an iframe which loads a series of links.
document.querySelectorAll('.nav-link').forEach(link => {
console.log(link.href)
if(link.href === document.getElementById("iFrames").contentWindow.location.href {
link.setAttribute('aria-current', 'page')
}
})
I expect the bottom border to highlight the current navbar li.
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Viewer</title>
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="">
<meta property="og:type" content="">
<meta property="og:url" content="">
<meta property="og:image" content="">
<link rel="stylesheet" href="stylesheet.css">
</head>
<body>
<div class="topnav" id="myTopnav">
<ul role="menubar" class="nav-links">
<li><a class="nav-link" href="https://development.beeldenfabriek.nl/impression/" target="iFrames">Impressie</a></li>
<li><a class="nav-link" href="https://development.beeldenfabriek.nl/cinemagraph/" target="iFrames">Cinemagraph</a>
<li><a class="nav-link" href="https://development.beeldenfabriek.nl/animation/" target="iFrames">Animatie</a>
<li><a class="nav-link" href="https://development.beeldenfabriek.nl/woningzoeker/" target="iFrames">Woningzoeker</a>
<li><a class="nav-link" href="https://development.beeldenfabriek.nl/vr/" target="iFrames">VR</a>
<li><a class="nav-link" href="https://development.beeldenfabriek.nl/visualstory/" target="iFrames">Visual Story</a>
<li><a class="nav-link" href="https://bf-virtual-experience-elzenhagen.s3.eu-west-2.amazonaws.com/tour.html/" target="iFrames">Spotlight</a>
<li><a class="projectPagina" href="https://development.beeldenfabriek.nl/template-website" target="_blank">Projectpagina</a>
</ul>
</div>
<section class="embedPages">
<iframe id="iFrames" name="iFrames" src="https://development.beeldenfabriek.nl/woningzoeker/" width="100%" height="100%" frameBorder="0"></iframe>
</section>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
.nav-link[aria-current="page"] {
border-bottom: 3px solid rgba(226, 220, 72, 1.0);
}

Related

The icon did not appear

I have this code and I want to use the "menu icon" in the code, but it did not appear, and I did not know why?
And this file contains a set of instructions containing the icon and other things, and as it is clear, the icon was placed in the Navbar, but it did not appear
<html DOCTYPE="html5">
<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">
<title>Website Using Flexbox</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<nav>
<div class="logo">
<h1>Portfolio</h1>
</div>
<ul>
<li>Home</li>
<li>About</li>
<li>Process</li>
<li>Testimony</li>
<li>Contact</li>
</ul>
<box-icon name="menu" type="solid"></box-icon>
</nav>
</header>
<script src="https://unpkg.com/boxicons#2.0.9/dist/boxicons.js"></script>
<script src="app.js"></script>
</body>
</html>
It seems element with attribute name="menu" has not attribute type="solid". However, element with attribute name="menu" has attribute type="regular" .
Removing type="solid" or swapping it to type="regular" will make it work.
<box-icon name="menu" type="regular"></box-icon>
<box-icon name="menu"></box-icon>
check demo in Full Page
put your boxicons script in <head></head> tag and it will start working here is the working demo update me if any change is required.
<html doctype="html5">
<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">
<title>Website Using Flexbox</title>
<link rel="stylesheet" href="style.css">
<script src="https://unpkg.com/boxicons#2.0.9/dist/boxicons.js"></script>
<script src="app.js"></script>
</head>
<body>
<header>
<nav>
<div class="logo">
<h1>Portfolio</h1>
</div>
<ul>
<li>Home</li>
<li>About</li>
<li>Process</li>
<li>Testimony</li>
<li>Contact</li>
</ul>
<box-icon name="menu" type="solid"></box-icon>
</nav>
</header>
</body>
</html>
I solved the problem by adding the "Font Awesome" library

Text color won't change on LI elements

As you can see on my code, on the left panel, i have an UL and 2 LI.
I want all LI as white color.
I've set style but is not professional, perhaps setting my own style:
lblBiancoMenu does not affect
what can i do?
.lblBiancoMenu {
color: white;
}
;
.subCat .li {
color: white;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Pushy - Off-Canvas Navigation Menu</title>
<meta name="description" content="Pushy is an off-canvas navigation menu for your website.">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Icons list-> https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
</head>
<body>
<div data-role="page" id="pageone">
<div style=" background-color: #101010; color: #ffffff;">
<h2 id="listCateg">Categories</h2>
<div id="SubCat3" class='subCat'>
<ul>
<li><a style="color:white" href="#">3</a></li>
<li><a class="lblBiancoMenu" href="#">4</a></li>
</ul>
</div>
</div>
</div>
</body>
</HTML>
The theme you're importing has its own CSS styles. The color rule being imported has a higher specificity than your rule, so your rule is being overridden.
To override the theme styles, either use inline CSS (as you have done). Embedding the CSS in the HTML tag gives it higher specificity.
Or use the !important annotation, which overrides all other CSS declarations.
Use this in your code:
.lblBiancoMenu {
color: white !important;
}
.lblBiancoMenu {
color: white !important;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Pushy - Off-Canvas Navigation Menu</title>
<meta name="description" content="Pushy is an off-canvas navigation menu for your website.">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Icons list-> https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
</head>
<body>
<div data-role="page" id="pageone">
<div style=" background-color: #101010; color: #ffffff;">
<h2 id="listCateg">Categories</h2>
<div id="SubCat3" class='subCat'>
<ul>
<li><a style="color:white" href="#">3</a></li>
<li><a class="lblBiancoMenu" href="#">4</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>

Why does Django causes my materialize link to appear blue when I hover over them?

as you can see when I hover over the dropdown box the link becomes blue, what could be the cause of this??
I am using Django with this maybe that could be causing problems
I tried it in a document with only the materialize header and it works just fine:
Here is the code:
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<!-- Dropdown Structure -->
<ul id="dropdown1" class="dropdown-content">
<li>one</li>
<li>two</li>
<li class="divider"></li>
<li>three</li>
</ul>
<nav>
<div class="nav-wrapper">
Logo
<ul class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<!-- Dropdown Trigger -->
<li>Dropdown<i class="material-icons right">arrow_drop_down</i></li>
</ul>
</div>
</nav>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script>
M.AutoInit()
$(".dropdown-trigger").dropdown();
</script>
</body>
When I combine it with my Django main page it messes up, what should I remove/add?
Main page header:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Stock Trading Website</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{%static "/css/main.css"%}">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
Please let me know if you need anything else :)

materialize header text overflow

I've been trying out materialize and when working on the nav bar, depending on how long the logo is, it will overflow outside the div as shown in the snippet if you were to shrink the window. How would you fix this?
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Quiz Manager</title>
</head>
<body>
<header>
<nav>
<div class="nav-wrapper">
Test Brand Logo
<i class="material-icons">menu</i>
<ul class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>Javascript</li>
<li>Mobile</li>
</ul>
</div>
</nav>
<ul class="sidenav" id="mobile-demo">
<li>Sass</li>
<li>Components</li>
<li>Javascript</li>
<li>Mobile</li>
</ul>
</header>
</body>
Add the following to your script:
$(document).ready(function () {
$('.sidenav').sidenav();
});

Menu not showing up using Foundation

I have the newest Foundation complete version and I am following this tutorial. https://www.youtube.com/watch?v=RK_k__4Y4TU
I am trying to get a menu but there is nothing on my website at all. It is just blank.
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<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">
<title>Foundation for Sites</title>
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<div class="off-canvas position-left" id="offCanvas" data-off-canvas>
<ul class="menu vertical">
<li>Links</li>
<li>Links</li>
</ul>
</div>
<div class="off-canvas-content" data-off-canvas-content></div>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/what-input.js"></script>
<script src="js/vendor/foundation.js"></script>
<script src="js/app.js"></script>
</body>
</html>
I tried your code and only mistake is you have written off-canvas insted of off-canvas-wrap.
No class exist with name off-canvas.
<div class="off-canvas-wrap position-left" id="offCanvas" data-off-canvas>

Resources