Basically I am trying to get the parent of the data-toggle="collapse". Currently my navbar has a id="sidebar". I only want to get the data-toggle="collapse" that are inside of this navbar only.
I tried the following but didn't work.
$('[#sidebar > data-toggle=collapse]').prop('disabled', false);
<nav id="sidebar" class="nav flex-column">
<div id="TitleSidebar" class="pt-2 pb-3 px-1 d-flex">
<span id="sidelogo" class="mr-auto p-2">Logo</span>
<button id="SideButtonOpenClose" type="button" class="btn btn-default" href="#" onclick="OpenCloseSideBar()">
<span class="fas fa-align-justify" aria-hidden="true"></span>
</button>
</div>
<!-- fIRST TAB -->
<div id="FirstTitle" class="nav-item active " onclick="changeActiveTabs(event)">
<a id="toggleDropDown" class="nav-link px-0 toggle-arrow " data-toggle="collapse" href="#submenu1" aria-expanded="false">
<div class="d-flex align-items-center justify-content-between ">
<span class="side-icons pl-3 pr-2 fas fa-home"></span>
<span class="sidebartitle text-nowrap mr-auto ">DashBoard</span>
<span class="downarrowicon mr-2 fas fa-angle-right"></span>
</div>
</a>
</div>
etc..
</nav>
The > combinator selects only immediate children. And attribute selectors must be in square brackets, but not the whole expression. Try this:
$('#sidebar [data-toggle=collapse]').prop('disabled', false);
Example:
// Returns one item.
console.log($('#sidebar [data-toggle=collapse]').length)
// Throws an error.
console.log($('[#sidebar > data-toggle=collapse]').length)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<nav id="sidebar" class="nav flex-column">
<div id="TitleSidebar" class="pt-2 pb-3 px-1 d-flex">
<span id="sidelogo" class="mr-auto p-2">Logo</span>
<button id="SideButtonOpenClose" type="button" class="btn btn-default" href="#" onclick="OpenCloseSideBar()">
<span class="fas fa-align-justify" aria-hidden="true"></span>
</button>
</div>
<!-- fIRST TAB -->
<div id="FirstTitle" class="nav-item active " onclick="changeActiveTabs(event)">
<a id="toggleDropDown" class="nav-link px-0 toggle-arrow " data-toggle="collapse" href="#submenu1" aria-expanded="false">
<div class="d-flex align-items-center justify-content-between ">
<span class="side-icons pl-3 pr-2 fas fa-home"></span>
<span class="sidebartitle text-nowrap mr-auto ">DashBoard</span>
<span class="downarrowicon mr-2 fas fa-angle-right"></span>
</div>
</a>
</div>
</nav>
Related
I'm integrating a bootstrap template into a react app and I'm having trouble getting two of the components- Home and ProductIndex - to render. When I inspect with the react dev tool the components aren't in the DOM at all. The html to follow has issues that I haven't begun to deal with yet, but for it not to render at all is mystifying me. Not sure what the problem is.
Here is the Home component
import React, { Component } from 'react'
class Home extends Component {
render() {
return (
<div>
<div className="modal fade" id="productView" tabindex="-1" role="dialog" aria-hidden="true">
<div className="modal-dialog modal-lg modal-dialog-centered" role="document">
<div className="modal-content">
<div className="modal-body p-0">
<div className="row align-items-stretch">
<div className="col-lg-6 p-lg-0"><a className="product-view d-block h-100 bg-cover bg-center" style="background: url(img/product-5.jpg)" href="img/product-5.jpg" data-lightbox="productview" title="Red digital smartwatch"></a><a className="d-none" href="img/product-5-alt-1.jpg" title="Red digital smartwatch" data-lightbox="productview"></a><a className="d-none" href="img/product-5-alt-2.jpg" title="Red digital smartwatch" data-lightbox="productview"></a></div>
<div className="col-lg-6">
<button className="close p-4" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<div className="p-5 my-md-4">
<ul className="list-inline mb-2">
<li className="list-inline-item m-0"><i className="fas fa-star small text-warning"></i></li>
<li className="list-inline-item m-0"><i className="fas fa-star small text-warning"></i></li>
<li className="list-inline-item m-0"><i className="fas fa-star small text-warning"></i></li>
<li className="list-inline-item m-0"><i className="fas fa-star small text-warning"></i></li>
<li className="list-inline-item m-0"><i className="fas fa-star small text-warning"></i></li>
</ul>
<h2 className="h4">Red digital smartwatch</h2>
<p className="text-muted">$250</p>
<p className="text-small mb-4">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut ullamcorper leo, eget euismod orci. Cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus. Vestibulum ultricies aliquam convallis.</p>
<div className="row align-items-stretch mb-4">
<div className="col-sm-7 pr-sm-0">
<div className="border d-flex align-items-center justify-content-between py-1 px-3"><span className="small text-uppercase text-gray mr-4 no-select">Quantity</span>
<div className="quantity">
<button className="dec-btn p-0"><i className="fas fa-caret-left"></i></button>
<input className="form-control border-0 shadow-0 p-0" type="text" value="1"/>
<button className="inc-btn p-0"><i className="fas fa-caret-right"></i></button>
</div>
</div>
</div>
<div className="col-sm-5 pl-sm-0"><a className="btn btn-dark btn-sm btn-block h-100 d-flex align-items-center justify-content-center px-0" href="cart.html">Add to cart</a></div>
</div><a className="btn btn-link text-dark p-0" href="#"><i className="far fa-heart mr-2"></i>Add to wish list</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="container">
<section className="hero pb-3 bg-cover bg-center d-flex align-items-center" style="background: url(img/hero-banner-alt.jpg)">
<div className="container py-5">
<div className="row px-4 px-lg-5">
<div className="col-lg-6">
<p className="text-muted small text-uppercase mb-2">New Inspiration 2020</p>
<h1 className="h2 text-uppercase mb-3">20% off on new season</h1><a className="btn btn-dark" href="shop.html">Browse collections</a>
</div>
</div>
</div>
</section>
<section className="pt-5">
<header className="text-center">
<p className="small text-muted small text-uppercase mb-1">Carefully created collections</p>
<h2 className="h5 text-uppercase mb-4">Browse our categories</h2>
</header>
<div className="row">
<div className="col-md-4 mb-4 mb-md-0"><a className="category-item" href="shop.html"><img className="img-fluid" src="img/cat-img-1.jpg" alt=""/><strong className="category-item-title">Clothes</strong></a></div>
<div className="col-md-4 mb-4 mb-md-0"><a className="category-item mb-4" href="shop.html"><img className="img-fluid" src="img/cat-img-2.jpg" alt=""/><strong className="category-item-title">Shoes</strong></a><a className="category-item" href="shop.html"><img className="img-fluid" src="img/cat-img-3.jpg" alt=""/><strong className="category-item-title">Watches</strong></a></div>
<div className="col-md-4"><a className="category-item" href="shop.html"><img className="img-fluid" src="img/cat-img-4.jpg" alt=""/><strong className="category-item-title">Electronics</strong></a></div>
</div>
</section>
<section className="py-5">
<header>
<p className="small text-muted small text-uppercase mb-1">Made the hard way</p>
<h2 className="h5 text-uppercase mb-4">Top trending products</h2>
</header>
<div className="row">
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-"></div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-1.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Kui Ye Chen’s AirPods</a></h6>
<p className="small text-muted">$250</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-primary">Sale</div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-2.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Air Jordan 12 gym red</a></h6>
<p className="small text-muted">$300</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-"></div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-3.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Cyan cotton t-shirt</a></h6>
<p className="small text-muted">$25</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-info">New</div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-4.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Timex Unisex Originals</a></h6>
<p className="small text-muted">$351</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-danger">Sold</div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-5.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Red digital smartwatch</a></h6>
<p className="small text-muted">$250</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-"></div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-6.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Nike air max 95</a></h6>
<p className="small text-muted">$300</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-"></div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-7.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Joemalone Women prefume</a></h6>
<p className="small text-muted">$25</p>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-sm-6">
<div className="product text-center">
<div className="position-relative mb-3">
<div className="badge text-white badge-"></div><a className="d-block" href="detail.html"><img className="img-fluid w-100" src="img/product-8.jpg" alt="..."/></a>
<div className="product-overlay">
<ul className="mb-0 list-inline">
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-outline-dark" href="#"><i className="far fa-heart"></i></a></li>
<li className="list-inline-item m-0 p-0"><a className="btn btn-sm btn-dark" href="cart.html">Add to cart</a></li>
<li className="list-inline-item mr-0"><a className="btn btn-sm btn-outline-dark" href="#productView" data-toggle="modal"><i className="fas fa-expand"></i></a></li>
</ul>
</div>
</div>
<h6> <a className="reset-anchor" href="detail.html">Apple Watch</a></h6>
<p className="small text-muted">$351</p>
</div>
</div>
</div>
</section>
<section className="py-5 bg-light">
<div className="container">
<div className="row text-center">
<div className="col-lg-4 mb-3 mb-lg-0">
<div className="d-inline-block">
<div className="media align-items-end">
<svg className="svg-icon svg-icon-big svg-icon-light">
<use href="#delivery-time-1"> </use>
</svg>
<div className="media-body text-left ml-3">
<h6 className="text-uppercase mb-1">Free shipping</h6>
<p className="text-small mb-0 text-muted">Free shipping worlwide</p>
</div>
</div>
</div>
</div>
<div className="col-lg-4 mb-3 mb-lg-0">
<div className="d-inline-block">
<div className="media align-items-end">
<svg className="svg-icon svg-icon-big svg-icon-light">
<use href="#helpline-24h-1"> </use>
</svg>
<div className="media-body text-left ml-3">
<h6 className="text-uppercase mb-1">24 x 7 service</h6>
<p className="text-small mb-0 text-muted">Free shipping worlwide</p>
</div>
</div>
</div>
</div>
<div className="col-lg-4">
<div className="d-inline-block">
<div className="media align-items-end">
<svg className="svg-icon svg-icon-big svg-icon-light">
<use href="#label-tag-1"> </use>
</svg>
<div className="media-body text-left ml-3">
<h6 className="text-uppercase mb-1">Festival offer</h6>
<p className="text-small mb-0 text-muted">Free shipping worlwide</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section className="py-5">
<div className="container p-0">
<div className="row">
<div className="col-lg-6 mb-3 mb-lg-0">
<h5 className="text-uppercase">Let's be friends!</h5>
<p className="text-small text-muted mb-0">Nisi nisi tempor consequat laboris nisi.</p>
</div>
<div className="col-lg-6">
<form action="#">
<div className="input-group flex-column flex-sm-row mb-3">
<input className="form-control form-control-lg py-3" type="email" placeholder="Enter your email address" aria-describedby="button-addon2"/>
<div className="input-group-append">
<button className="btn btn-dark btn-block" id="button-addon2" type="submit">Subscribe</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
<footer className="bg-dark text-white">
<div className="container py-4">
<div className="row py-5">
<div className="col-md-4 mb-3 mb-md-0">
<h6 className="text-uppercase mb-3">Customer services</h6>
<ul className="list-unstyled mb-0">
<li><a className="footer-link" href="#">Help & Contact Us</a></li>
<li><a className="footer-link" href="#">Returns & Refunds</a></li>
<li><a className="footer-link" href="#">Online Stores</a></li>
<li><a className="footer-link" href="#">Terms & Conditions</a></li>
</ul>
</div>
<div className="col-md-4 mb-3 mb-md-0">
<h6 className="text-uppercase mb-3">Company</h6>
<ul className="list-unstyled mb-0">
<li><a className="footer-link" href="#">What We Do</a></li>
<li><a className="footer-link" href="#">Available Services</a></li>
<li><a className="footer-link" href="#">Latest Posts</a></li>
<li><a className="footer-link" href="#">FAQs</a></li>
</ul>
</div>
<div className="col-md-4">
<h6 className="text-uppercase mb-3">Social media</h6>
<ul className="list-unstyled mb-0">
<li><a className="footer-link" href="#">Twitter</a></li>
<li><a className="footer-link" href="#">Instagram</a></li>
<li><a className="footer-link" href="#">Tumblr</a></li>
<li><a className="footer-link" href="#">Pinterest</a></li>
</ul>
</div>
</div>
<div className="border-top pt-4" style="border-color: #1d1d1d !important">
<div className="row">
<div className="col-lg-6">
<p className="small text-muted mb-0">© 2020 All rights reserved.</p>
</div>
<div className="col-lg-6 text-lg-right">
<p className="small text-muted mb-0">Template designed by <a className="text-white reset-anchor" href="https://bootstraptemple.com/p/bootstrap-ecommerce">Bootstrap Temple</a></p>
</div>
</div>
</div>
</div>
</footer>
</div>
)
}
}
export default Home
Here is the Header component (this is rendering)
import React, { Component } from 'react';
class Header extends Component {
render() {
return (
<header class="header bg-white">
<div class="container px-0 px-lg-3">
<nav class="navbar navbar-expand-lg navbar-light py-3 px-lg-0"><a class="navbar-brand" href="index.html"><span class="font-weight-bold text-uppercase text-dark">Boutique</span></a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link active" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="shop.html">Shop</a>
</li>
<li class="nav-item">
<a class="nav-link" href="detail.html">Product detail</a>
</li>
<li class="nav-item dropdown"><a class="nav-link dropdown-toggle" id="pagesDropdown" href="#nav" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Pages</a>
<div class="dropdown-menu mt-3" aria-labelledby="pagesDropdown"><a class="dropdown-item border-0 transition-link" href="index.html">Homepage</a><a class="dropdown-item border-0 transition-link" href="shop.html">Category</a><a class="dropdown-item border-0 transition-link" href="detail.html">Product detail</a><a class="dropdown-item border-0 transition-link" href="cart.html">Shopping cart</a><a class="dropdown-item border-0 transition-link" href="checkout.html">Checkout</a></div>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a class="nav-link" href="cart.html"> <i class="fas fa-dolly-flatbed mr-1 text-gray"></i>Cart<small class="text-gray">(2)</small></a></li>
<li class="nav-item"><a class="nav-link" href="#nav"> <i class="far fa-heart mr-1"></i><small class="text-gray"> (0)</small></a></li>
<li class="nav-item"><a class="nav-link" href="#nav"> <i class="fas fa-user-alt mr-1 text-gray"></i>Login</a></li>
</ul>
</div>
</nav>
</div>
</header>
)
}
}
export default Header;
Here is App.js
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Home from './Home/Home.js'
import Header from './Header/Header.js'
import ProductIndex from './ProductIndex/ProductIndex.js'
function App() {
return (
<div className="wrapper">
<Router>
<Switch>
<Header/>
<Route exact path="/" component={ Home } />
<Route exact path="/products" component={ ProductIndex } />
</Switch>
</Router>
</div>
);
}
export default App;
and index.js
import React from 'react'
import ReactDOM from 'react-dom'
// import './index.scss'
import App from './App'
import { BrowserRouter } from 'react-router-dom'
const appJsx = (
<BrowserRouter>
<App />
</BrowserRouter>
)
ReactDOM.render(appJsx, document.getElementById('root'))
The reason the components do not appear is because the Header is inside teh Switch it should be outside
function App() {
return (
<div className="wrapper">
<Header/>
<Router>
<Switch>
<Route exact path="/" component={ Home } />
<Route exact path="/products" component={ ProductIndex } />
</Switch>
</Router>
</div>
);
}
in addition you have a lot of issues in the code just look at the console...
So i have a footer template i want to use but when I add the content between the footer and the header I am left with a white space between the footer and the content. what could be the problem I haven't used any margins on the elements.
HTML
Head
<head>
<meta charset="UTF-8">
<title>CodePen - Bootstrap 4 Navbar</title>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.0.0/css/bootstrap.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/4.7.0/css/font-awesome.css'><link rel="stylesheet" href="./style.css">
</head>
Header
<header>
<!--- Navbar --->
<nav class="navbar navbar-expand-lg">
<div class="container">
<a class="navbar-brand text-white" href="#"><i class="fa fa-graduation-cap fa-lg mr-2"></i>BLOG</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#nvbCollapse" aria-controls="nvbCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="nvbCollapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item pl-1">
<a class="nav-link" href="#"><i class="fa fa-home fa-fw mr-1"></i>Anasayfa</a>
</li>
<li class="nav-item active pl-1">
<a class="nav-link" href="#"><i class="fa fa-th-list fa-fw mr-1"></i>Blog</a>
</li>
<li class="nav-item pl-1">
<a class="nav-link" href="#"><i class="fa fa-info-circle fa-fw mr-1"></i>Hakkımızda</a>
</li>
<li class="nav-item pl-1">
<a class="nav-link" href="#"><i class="fa fa-phone fa-fw fa-rotate-180 mr-1"></i>İletişim</a>
</li>
<li class="nav-item pl-1">
<a class="nav-link" href="#"><i class="fa fa-user-plus fa-fw mr-1"></i>Kayıt Ol</a>
</li>
<li class="nav-item pl-1">
<a class="nav-link" href="#"><i class="fa fa-sign-in fa-fw mr-1"></i>Oturum Aç</a>
</li>
</ul>
</div>
</div>
</nav>
<!--# Navbar #-->
</header>
Footer
<footer>
<div class="jumbotron jumbotron-fluid bg-secondary p-4 mt-5 mb-0">
<div class="container">
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-4 cizgi">
<div class="card bg-secondary border-0">
<div class="card-body text-light text-center">
<h5 class="card-title text-white display-4" style="font-size:30px">Telif Hakkı</h5>
<p class="d-inline lead">Tüm Hakları Saklıdır © 2018<br>
Blog
</p>
</div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4 cizgi">
<div class="card bg-secondary border-0">
<div class="card-body text-center">
<h5 class="card-title text-white display-4" style="font-size:30px">İletişim</h5>
<a class="text-light d-block lead" style="margin-left: -20px" href="#"><i class="fa fa-phone mr-2"></i>+90 (000) 000 0 000</a>
<a class="text-light d-block lead" href="#"><i class="fa fa-envelope mr-2"></i>admin#localhost.com</a>
</div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<div class="card bg-secondary border-0">
<div class="card-body text-center">
<h5 class="card-title text-white display-4" style="font-size:30px">Sosyal Medya</h5>
<a class="text-light" href="#"><i class="fa fa-facebook-square fa-fw fa-2x"></i></a>
<a class="text-light" href="#"><i class="fa fa-twitter-square fa-fw fa-2x"></i></a>
<a class="text-light" href="#"><i class="fa fa-instagram fa-fw fa-2x"></i></a>
<a class="text-light" href="#"><i class="fa fa-linkedin fa-fw fa-2x"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
and the css
.navbar { background-color: #484848; }
.navbar .navbar-nav .nav-link { color: #fff; }
.navbar .navbar-nav .nav-link:hover { color: #fbc531; }
.navbar .navbar-nav .active > .nav-link { color: #fbc531; }
footer a.text-light:hover { color: #fed136!important; text-decoration: none; }
footer .cizgi { border-right: 1px solid #535e67; }
#media (max-width: 992px) { footer .cizgi { border-right: none; } }
and that's what shows on my browser
This white space stays there no matter what I add between the header and footer any ideas ?
added simple text to demonstrate the white space
i was about to answer the same <div class="jumbotron jumbotron-fluid bg-secondary p-4 mb-0">
Nevermind i found what was causing it the boostrap template i used had the attribute mt-5 added to the footer class which is a boostrap attribute that adds top margin to the element changing it to mt-0 fixed it for me.
<section class="bg-secondary-dark py-2">
<div class="container">
<div class="row justify-content-between">
<div class="col-md-6">
<i class="fas fa-envelope"></i>
</div>
<div class="col-md-6 text-right">
<i class="fab fa-facebook mr-3 text-muted"></i>
</div>
</div>
</div>
</section>
<nav class="navbar navbar-expand-lg navbar-light py-0 bg-white justify-content-between **fixed-top**">
<div class="container">
<a class="navbar-brand"><img src="assets/img/logo.png" class="img-fluid"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>
</div>
</nav>
this is sticky bootstrap navbar. i downloaded bootstrap and js using npm and didn't used custom css
I have a sidebar menu that's built using Bootstrap 4. To create a submenu that expanded right utilizing jQuery. It looks like this:
<div class="container-fluid">
<div class="row">
<nav class="col-md-1 d-none d-md-block sidebar">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link d-flex align-items-center flex-column sidebar" href="#" data-toggle="collapse" data-target="#submenu" aria-expanded="false" id="sidebarCollapse" >
<%= image_tag 'products.png' %>
<p>Products</p>
</a>
</li>
</ul>
</div>
</nav>
<!--Product Sidebar-->
<nav id="sidebar">
<div class="sidebar-header">
<h3>Bootstrap Sidebar</h3>
</div>
<ul class="list-unstyled components">
<li class="active">
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
Main Item
</a>
<ul class="collapse list-unstyled" id="homeSubmenu">
<li>
Item 1
</li>
<li>
Item 2
</li>
<li>
Item 3
</li>
</ul>
</li>
</ul>
</nav>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Dashboard</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<button class="btn btn-sm btn-outline-secondary">Share</button>
<button class="btn btn-sm btn-outline-secondary">Export</button>
</div>
</div>
</div>
<canvas class="my-4 w-100" id="myChart" width="900" height="380"></canvas>
</main>
</div>
</div>
Then the jQuery:
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
});
});
This mostly works correctly. I click on the anchor tag of Products and the submenu/sidebar opens up to the right. However the problem is when not active it will show Bootstrap Sidebar and Main Item. How do I get it so that when not active that the sidebar has a visibility of hidden?
I've tried the following with jQuery with no luck:
$(document).ready(function () {
$('#sidebar').hide();
$('#sidebarCollapse').on('click', function (e) {
e.preventDefault();
$('#sidebar', this).toggle('active');
});
});
Do you have your CSS set up to hide it initially?
#sidebar {
display:none;
}
#sidebar.active{
display:block;
}
I write this code:
$('.toggler').click(function() {
$(this).parent().nextAll('ul').toggleClass('closed');
if ($(this).parent().next('ul') != true) {
$(this).prev().removeClass('ion-ios-plus-outline');
$(this).prev().addClass('ion-ios-minus-outline');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<ul>
<!-- First level -->
<li class="branch">
<!-- btn -->
<div class="d-flex justfiy-content-between">
<i class="ion-ios-plus-outline ml-2"></i>
<span class="toggler ml-3">لول اول</span>
<span class="btns d-flex">
<a class="bg-danger" href="">
<i class="ion-trash-b"></i>
</a>
<a class="bg-info mr-2" href="">
<i class="ion-edit"></i>
</a>
</span>
</div>
<!-- Second level -->
<ul class="closed">
<li class="branch">
<!-- btn -->
<div class="d-flex justfiy-content-between">
<i class="ion-ios-plus-outline ml-2"></i>
<span class="toggler ml-3">لول دوم</span>
<span class="btns d-flex">
<a class="bg-danger" href="">
<i class="ion-trash-b"></i>
</a>
<a class="bg-info mr-2" href="">
<i class="ion-edit"></i>
</a>
</span>
</div>
</li>
</ul>
</li>
<!-- First level -->
<li class="branch">
<!-- btn -->
<div class="d-flex justfiy-content-between">
<i class="ion-ios-plus-outline ml-2"></i>
<span class="toggler ml-3">لول اول</span>
<span class="btns d-flex">
<a class="bg-danger" href="">
<i class="ion-trash-b"></i>
</a>
<a class="bg-info mr-2" href="">
<i class="ion-edit"></i>
</a>
</span>
</div>
</li>
</ul>
I have a condition in this click function, it works nice. but it just works when I click on that button, but I want this condition to work outside this click function!