bootstrap navbar hamburger menu - javascript

So I have been trying to develop this site for a friend of mine and i can't seem to get the hamburger menu to appear. I have been trying to get this for hours, and nothing seems to work. Is the format for the navbar wrong, or am I missing something, this is EXTREMELY frustrating. So i added the css and now the hamburger menu appears but it just looks like a red box. It also appears on larger screens, which its only supposed to appear on smaller devices.
<!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, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<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">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 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 type="text/javascript" src="script/script.js"></script>
<title>Bootstrap</title>
</head>
<body class="darkbg">
<nav class="navbar navbar-expand-lg navbar-white d-flex justify-content-center">
<button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar-dropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link nvm-link current-link" href="index.html"> NVM </a>
</li>
<li class="nav-item">
<a class="nav-link non-active-link" href="gallery.html"> GALLERY </a>
</li>
<li class="nav-item">
<a class="nav-link non-active-link" href="shop.html"> SHOP </a>
</li>
<li class="nav-item">
<a class="nav-link non-active-link" href="#"> MUSIC </a>
</li>
<li class="nav-item">
<a class="nav-link non-active-link" href="#"> CONTACT </a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid full-height">
<div class="row">
<div class="col-lg-6">
<div class="home-article">
<h2 class="home-header flexFont">WHO THE HELL ARE WE?</h2>
<p class="text-indent main-text"> Hell is full, of all the torturing, screaming, killing, fire, smoke, and poker games a demon could ask for. Unforunately, Satan had no interest in giving us what we needed to have a successful business in the underworld, and most of the other
demons laughed in our faces or ignored us. </p>
<p class="text-indent main-text"> Nobody in hell cared about us, and why would they? It's fucking hell, but me and my cool ass friends knew we deserved more than that. So, we sought out to find the prophesied portal to the surface realm. And guess what bitches, WE FOUND IT!
</p>
<p class="text-indent main-text"> After we celebrated, we closed the portal to prevent any lames from rising above and stealing our awesome idea, We were gonna make this business happen in a world where people care about looking badass(almost everone in hell is pretty badass).</p>
<p class="text-indent main-text"> After we arrived, you humans didn't really take kindly to a bunch of unholy beasts trying to sell you shit, understandable. So we did some research, removed our horns, and made ourselves some awesome masks. <br> NOW WE LOOK LIKE YOU! BOOM! </p>
<p class="text-indent main-text"> You're welcome, it took a lot of soul for us to demote ourselves to your standard so you could buy our gold, so have some fucking empathy. Look at our art, buy our clothes and other cool ass merchandise, sign up for our newsletter too while
you're at it. </p>
<p class="text-indent main-text"> Don't worry. We don't want to kill you, without you we serve no purpose. We just want to spread our noise surface-wide(and then maybe eat your soul, if you're a poser). </p>
<p class="text-indent main-text bottom-text"> Welcome to <a class="text-red" href="#"> NVM </a>, the home of the designer demons.</p>
</div>
</div>
<div class="col-lg-6">
<img class="demon-pic" src="" alt="IMAGE OF THE SEVEN OF US DRAWN AS OUR DEMONS">
</div>
</div>
</div>
</body>
</html>
This is my CSS:
.navbar-toggle {
background-color: transparent;
background-image: none;
border: 1px solid transparent;
}
.navbar-toggle .icon-bar {
background-color: red;
}

You're missing the important class navbar-light for your <nav element.
This class is required to show icons and colors correctly within the navbar.
So just change from
<nav class="navbar navbar-expand-lg navbar-white d-flex justify-content-center">
to
<nav class="navbar navbar-expand-lg navbar-white d-flex justify-content-center navbar-light">
And the hamburger icon will be visible

Related

jQuery toggleClass breaks on fast click

I have a dropdown menu made in Bootstrap. I implemented a jQuery toggleClass on the dropdown menu icon that changes the icon on click. Normally, it is supposed to show the hamburger icon when the menu is closed, then change to an X icon when the menu is open. But the problem here is that, if the menu is clicked too fast(a double click), the reverse would then be the case(i.e The menu then shows an X icon when closed and a hamburger icon when open). And I dont want that. Here is the code snippet.
$("span.toggler").click(function() {
$("#toggler-icon").toggleClass("fa-bars fa-times");
})
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Hi</a>
<span class="toggler">
<span id="toggler-icon" class="fa-solid navbar-toggler fa-bars fa-2x text-white" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"></span>
</span>
<div class="collapse text-white navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">
<span class="fa-solid fa-home"></span> Dashboard </a>
</li>
</ul>
</div>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js"></script>
Is there a way I can prevent this?
If you use the right selectors, you can style the toggler icon based on the navbar's state (collapsed or not).
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
button.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
background-image: none;
}
button.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
content: "\58";
line-height: 2rem;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="fa navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">Features</a>
<a class="nav-link" href="#">Pricing</a>
<a class="nav-link disabled">Disabled</a>
</div>
</div>
</div>
</nav>
<h1>Hello, world!</h1>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
</body>
</html>
NOTE: My Answer is more about giving you intuition on WHAT the problem is and WHY it's happening. I think #kmoser's suggestion is the best suggestion.
The issue is JavaScript Call Stack is competing with the Render Event Loop creating a race condition which the render events will always loose. But Why?
Render event's travel thru the browsers Event-Loop onto JavaScript's Call Stack. BUT, button clicks travel directly to the Call Stack, skipping the event loop. Which means, button clicks are executed immediately (in most cases: synchronously) while render events are executed asynchronously (most of the time) and thus the render events don't have a chance to be appended to the Call Stack in the order you intended.
Why? Because they typically carryout animations! and animations are always syntactically described with some millisecond delay runtime.
CSS Stylesheet Syntax Example:
animation: .5s linear 1s infinite alternate slidein;
The .5s is an asynchronous side-effect. Therefore it will automatically be put onto the Browsers Event-Loop, and whenever JavaScript's Call-Stack says
Hey event loop, i'm finished with all these button clicks, I'm ready for that animation you're holding!
then it executes the animation by pushing it onto the Call Stack.
In your case, if you looked under-the-hood into Bootstraps CSS files you'd find some animating syntax per my example for the dropdown with the millisecond runtime defined.
The solution?
As #kmoser pointed out, the intended way to accomplish your desired task is to trigger css icon changes (Hamburger to X) based on css actions (animations: dropdown open, dropdown closed), rather than user actions.
Hope that helps.

bootstrap3 navbar collapsed on jsfiddle but not work on local browser

bootstrap3 navbar collapse worked on jsfiddle as following.
https://jsfiddle.net/wa3he6bn/1/
<html>
<header>
<title>title</title>
....
</header>
<body>
<div class="wrap">
<nav id="w1" class="navbar-default navbar-fixed-top navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w1-collapse"><span
class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button>
<a class="navbar-brand" href="/index.php">Logo</a></div>
<div id="w1-collapse" class="collapse navbar-collapse">
<ul id="w2" class="navbar-nav navbar-right nav">
<li>主页</li>
<li>文档</li>
<li>卷库</li>
<li class="help-link"><a href="javascript:void(0);"><span
class="glyphicon glyphicon-question-sign"></span></a></li>
<li><span class="glyphicon glyphicon-shopping-cart"></span>
</li>
</ul>
</div>
</div>
</nav>
</div>
</body>
</html>
but when save same html and run locally, it does not collaspe.
First of all use <head> instead of <header> then Try to use this meta tag in your <head> section
<meta name="viewport" content="width=device-width, initial-scale=1">
then the navbar will collapse for all screen sizes smaller then 768px as bootstrap's default behaviour.
So to expand it on certain screen break point you can add this class combination
navbar-expand-* to the main nav element.
Hope it works for you.
There are multiple things you should consider in your code.
You should put your resources in <head> not <header>. There is a major difference between these two, one contains machine-readable information while the other represents introductory content.
You need to load jquery.min.js before bootstrap.min.js, because the bootstrap will need to use jQuery.
You also need to add <meta name="viewport" content="width=device-width, initial-scale=1"> to your <head> to be able to control viewport in all screen sizes.
By honoring these two notes your code should work as expected.
<html>
<head>
<title>title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="wrap">
<!-- 以下为页眉内容 -->
<nav id="w1" class="navbar-default navbar-fixed-top navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w1-collapse"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button>
<a class="navbar-brand" href="/index.php">Logo</a></div>
<div id="w1-collapse" class="collapse navbar-collapse">
<ul id="w2" class="navbar-nav navbar-right nav">
<li>主页</li>
<li>文档</li>
<li>卷库</li>
<li class="help-link"><span class="glyphicon glyphicon-question-sign"></span></li>
<li><span class="glyphicon glyphicon-shopping-cart"></span>
</li>
</ul>
</div>
</div>
</nav>
<!-- 结束 -->
</div>
</body>
</html>
Use <head> tag. and include js files near the end of your page, right before the closing of </body> tag.
To save time in the future, please visit bootstrap official docs.
https://getbootstrap.com/docs/4.5/getting-started/introduction/
it's one of the best and well-written documentation.

Button in bootstrap not working as expected

I have been trying to use bootstrap(4) to creat a website. I got stuck at creating menu with dropdown lists. I cannot make it work, I even tried copying exact code of the docs for bootstrap and it still doesnt work. I have checked and rechecked paths for bootstrap css and js and I really dont know how to make it work.
While at it, can I use bootstrap to create dropdown lists inside dropside lists? It is for Menu purposes.
bootstrap docs, w3schools and other websites. even copying exact code makes no difference, the button doesnt work
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" media="screen" href="bootstrap/css/bootstrap-grid.css">
<link rel="stylesheet" media="screen" href="bootstrap/css/bootstrap-grid.min.css">
<link rel="stylesheet" media="screen" href="bootstrap/css/bootstrap-reboot.css">
<link rel="stylesheet" media="screen" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" media="screen" href="bootstrap/css/bootstrap-reboot.min.css">
<title>Animal World</title>
<style>
</style>
<img src="animalworld.jpg" class="img-fluid w-100" alt="Animal">
<div class="dropdown fixed-top bg-faded ">
<button class="btn dropdown-toggle" type="button" id="DropDownAnimals" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Animals
</button>
<div class="dropdown-menu" aria-labelledby="DropDownAnimals">
<button class="dropdown-item" >Dogs</button>
<button class="dropdown-item" type="button">Horses</button>
<button class="dropdown-item" type="button">Birds</button>
</div>
</div>
<!--<nav id="navbar" class="navbar fixed-top navbar-collapse-md navbar-light bg-faded">
<a class="navbar-brand" href="#">Animal World</a>
<button class="navbar-toggler-right" type="button" data-toggle="collapse" data-target="#MainMenu" aria-controls="MainMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="MainMenu" class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Animals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Stuff</a>
</li>
</ul>
</div>-->
<script src="bootstrap/js/bootstrap.bundle.js"></script>
<script src="bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></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://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script>
</script>
In the above code there are two different parts of code both for similar button. First doesnt work at all. second does, but in a way that just makes button move to right and the 3 other buttons appear on left. unable to change it at all. I would expect the dropdown come directly underneath the button as per docs.
I think you're importing your scripts in the wrong order.
Try putting the jquery script tag first, then the popper script, then you Bootstrap scripts.
And to answer your subsidiary question, it is absolutely possible to put a dropdown into a dropdown.

No responsive links in bootstrap 4

What would make links non responsive in bootstrap? My links won't switch through my pages as they would do live. Any ideas ?
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<nav class="navbar navbar-dark bg-dark navbar-expand-sm">
<div class="container ">
<a class="navbar-brand d-none d-sm-inline-block fixed-top" href="#">Larry J designs</a>
<ul class="navbar-nav ">
<li class="nav-item "><a class ="nav-link active" href="index.html">Home</a></li>
<li class="nav-item"> <a class ="nav-link " href="about.html">About</a></li>
<li class="nav-item"> <a class ="nav-link" href="portfolio.html">Portfolio</a></li>
<li class="nav-item"> <a class ="nav-link" href="services.html">Services</a></li>
</ul>
<div class="clearfix">
<ul class="navbar-nav ">
<li class="nav-item "><a class ="nav-link active" href="index.html">Home</a></li>
<li class="nav-item"> <a class ="nav-link " href="about.html">About</a></li>
<li class="nav-item"> <a class ="nav-link" href="portfolio.html">Portfolio</a></li>
<li class="nav-item"> <a class ="nav-link" href="services.html">Services</a></li>
</ul>
</div>
</div>
</nav>
<!-- navbar-nav -->
<div class="container">
<section class="container" id ="mainpage">
<div class ="row">
<article class="col-8" id="bio">
<h1>Welcome to Larry J designs </h1>
<p class="justify-content-center">Hello, I'm Larry J , I currently live in the DC Metro area , I also love working on art in my spare time. As a teen in high I use to love to draw and build websites , Currently, I work a full time job like most , however in my spare time I love working on learning web design and drawing . Life has a long road to success , but on the road there are that you have to learn to get to the next level. </p></article>
<section class="col-sm-4">
<div class="row no-gutters">
<div class="col"><img src="about-thumbnail-placeholder.png" alt="larryphoto
" class="img-thumbnail">
</div>
</div>
</section>
</div>
</section>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
You're not using rows or columns and this will have a major effect on the responsiveness of Bootstrap.
You need to look into the Bootstrap Grid system, I advise reading through this page and applying these practices to your code:
https://getbootstrap.com/docs/4.0/layout/grid/
First of all, you should note that non responsive has a different meaning in the world of code, not just the simple 'not working' definition, but also meaning the layout will adapt and respond to the device and browser sizes, this is Responsive Design.
I believe that your problem is occuring from the title overlapping the other links, stopping them from ever interacting with the mouse, only the title will interact. You can look into Chrome's Dev Tools using the right click Inspect option on the links. This happens because the title <a> has a fixed-top class. Removing this solves the issue.
From:
<a class="navbar-brand d-none d-sm-inline-block fixed-top" href="#">Larry J designs</a>
To:
<a class="navbar-brand d-none d-sm-inline-block" href="#">Larry J designs</a>
I highly suggest you read up on the Bootstrap 4 Docs to get a grasp and understand how everything works and how to use the fixed-top class if you were trying to make the nav fixed. Also, looking at the examples and inspecting their code help too.

Bootstrap working on Local Host but not on online server

The code was working perfectly on local host with xampp. All I've done is upload it to a server and now it's not working.
I uploaded all the BS files as well. I also fixed the href links to be '..../js/bootstrap.min.js' etc. No images load and nor does bootstrap I do not think. The reason I think the problem comes from Bootstrap is because all the text/buttons still appear, they just aren't customised with the css/JS as BS does.
They are php files.
This is a link to the site: http://www.johnnythyroid.com.
I'm only new and this is just for learning so all advice is much appreciated.
This is the relevant code I think, I deleted a lot of the stupid text to make it shorter:
<!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">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Jod</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel='stylesheet' type='text/css' href="johnnythyroidcom.ipage.com/css/custom icons.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="johnnythyroidcom.ipage.com/js/bootstrap.min.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-custom navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"> Navbar toggle </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="johnnythyroidcom.ipage.com/dansite1.php">Some Name</a>
</div>
<div class="navbar-collapse collapse" style="line-height:21px; height:140px;"> <!-- added this to prevent change of navbar height when switching between login/logout screens -->
<ul class="nav navbar-nav navbar-right">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
<li class="dropdown">
Account<b class="caret"></b>
<ul class="dropdown-menu">
<li class="dropdown-header"></li>
<li>Login</li>
<li>Create Account</li>
<!-- <li class="divider"></li>
<li class="dropdown-header">Portfolio</li>
<li>Portfolio 1</li>
<li>Portfolio 2</li> add divider to split up a drop down menu -->
</ul>
</li>
<li class="navbar-text pull-right signedin"> Welcome, Guest! </li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="jumbotron text-center">
<h1> The </h1>
<p> A simgn </p>
Bg
ng
</div>
<div class="row-same-height">
<div class="col-md-4"> <!-- works on a 12 point grid system - columns need to add up to 12 in a row-->
<a href="johnnythyroidcom.ipage.com/rocket.php" class="thumbnail home-thumb">
<img src="johnnythyroidcom.ipage.com/Img/first rocket.jpg" style="max-height:250px" alt="First rocket theme"/>
</a>
<h3> Rjj </h3>
<p>sum dolor sit amet.</p>
</p>
View more
</div>
<div class="col-md-4"> <!-- works on a 12 point grid system - columns need to add up to 12 in a row-->
<a href="johnnythyroidcom.ipage.com/stars.php" class="thumbnail home-thumb">
<img src="johnnythyroidcom.ipage.com/Img/sky.jpg" style="max-height:250px" alt="sky theme"/>
</a>
<h3> Ss </h3>
<p>Lorenim.</p>
View more
</div>
<div class="col-md-4"> <!-- works on a 12 point grid system - columns need to add up to 12 in a row-->
<a href="johnnythyroidcom.ipage.com/sky.php" class="thumbnail home-thumb">
<img src="johnnythyroidcom.ipage.com/Img/stars.jpg" style="min-height:227px" alt = "Star theme"/>
</a>
<h3> y </h3>
<p>Lorenim.</p>
View more
</div>
</div>
</div>
<div class="navbar navbar-inverse navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="navbar-text pull-left">
<p> aaaaaa </p>
</div>
<div class="navbar-text pull-right">
<i class="fa fa-facebook-square fa-2x"></i>
<i class="fa fa-twitter fa-2x"></i>
<i class="fa fa-google-plus fa-2x"></i>
</div>
</div>
</div>
Try this
change
<img src="johnnythyroidcom.ipage.com/Img/first rocket.jpg" style="max-height:250px" alt="First rocket theme">
into
<img src="http://johnnythyroidcom.ipage.com/Img/first rocket.jpg" style="max-height:250px" alt="First rocket theme">
add http:// to your all images src
Check the console for errors.
It says, Bootstrap's JavaScript requires jQuery, As I could see, You have included it and it is loaded correctly. Include that file before including bootstrap.min.js
Also correct that path of images. Your request url becomes: http://www.johnnythyroid.com/johnnythyroidcom.ipage.com/Img/first%20rocket.jpg which is incorrect.
Note: Just a blind guess, Incorrect path could be because of .htaccess
when reffering 3rd party include css or jss
you have to use https if your server is using https
else use http
for example you are accessing your site http://yoursite.com or http://localhost
then http://getbootstrap.com/css/bootstrap.min.js or css will work
that is why it works on localhost
but if you use https for yoru site https://yoursidte.com
then http://getbootstrap.com/css/bootstrap.min.js or css will not work
you will have to user https
e.g https://getbootstrap.com/css/bootstrap.min.js or css
THIS WAS THE CASE WHY MY menu were wroking on localcomputer but not over https , after changing from http to https://getbootstrap.com/css/bootstrap.min.js or css now it is working ..
all these files can be in different locations
for example you may save bootstrap.min.css in your site folder in case you edited that file ..

Categories

Resources