I want to create a template with Bootstrap. Firstly, I added two navbar. I used position is fixed. I want to use toogle menu with Detail, List and Map links. Later I created three div elements. First element have col-md-2 class. Second element have col-md-4 class. Third element have col-md-6 class. When the page is loaded the third element default class have col-md-12. Detail is clicked the map class should be col-md-10 and first div should be visible. Later List is clicked if first div is not visible List should be visible and map should be col-md-8. When the first div is visible and second div is clicked. First div should be col-md-2. Second div should be col-md-4 and map should be col-md-6. How can I solve? Also map didnt work on https://jsfiddle.net. Fiddle link is https://jsfiddle.net/sgq0oqeb/5/ .
HTML code
<nav class="navbar navbar-default navbar-fixed-top" style="border-bottom:1px solid #cdcdcd; min-height:40px;">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav pull-right">
<li>Home</li>
<li>Place</li>
<li>Profile</li>
</ul>
</div>
</nav>
<nav class="navbar navbar-default"style="margin-top:50px; margin-bottom:0px; background-color:#cafd96; border:0 !important; height:40px;">
<div class="container-fluid">
<ul class="nav navbar-nav pull-right">
<li><a id="menu-toggle">Detail</a></li>
<li><a id="menu-toggle2">List</a></li>
<li class="active">Map</li>
</ul>
</div>
</nav>
<div class="col-md-2 hidden" style="border:1px solid black" id="detail">
<div class="container-fullwidth">
<div id="wrapper">
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
Start Bootstrap
</a>
</li>
<li>
Dashboard
</li>
<li>
Shortcuts
</li>
<li>
Overview
</li>
<li>
Events
</li>
<li>
About
</li>
<li>
Services
</li>
<li>
Contact
</li>
</ul>
</div>
<div id="page-content-wrapper">
<div class="container-fluid">
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4 hidden" id="list">
Second Div
</div>
<div class="col-md-12" style="padding:0px;" id="harita">
<nav class="navbar navbar-default"style=" margin-bottom:0px; border-radius:0px; background-color:#cdcdcd">
<div class="container-fluid">
<ul class="nav navbar-nav pull-right">
<!--<li class="active">Home</li>-->
</ul>
</div>
</nav>
<div id="map"></div>
</div>
<nav class="navbar navbar-default navbar-fixed-bottom" style="z-index:1 !important; background-color:#cdcdcd">
<div class="container-fluid">
<ul class="nav navbar-nav pull-right">
<!--<li class="active">Home</li>-->
</ul>
</div>
</nav>
Javascript code
var map;
var marker;
var infowindow = new google.maps.InfoWindow();
function initialize() {
var mapOptions = {
center: {
lat: 38.72837591823979,
lng: 35.13427734375
},
zoom: 7,
mapTypeId: google.maps.MapTypeId.HYBRID
};
map = new google.maps.Map(document.getElementById('map'), mapOptions);
};
google.maps.event.addDomListener(window, 'load', initialize);
Related
my menu put in header.html which will be loaded in all pages.
If I click the menu from index.html, it will open the corresponding accordion panel in product.html by using below js code (which place in the end of product.html markup ).
But if I click the menu from product.html, no respond from the accordion panel.
what wrong with my code?
$(function(){
// check if there is a hash in the url
if ( window.location.hash != '' )
{
// remove any accordion panels that are showing (they have a class of 'in')
$('.collapse').removeClass('in');
// show the panel based on the hash now:
$(window.location.hash + '.collapse').collapse('show');
}
});
header.html
<header>
<nav class="navbar navbar-default menu" role="navigation">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle menu-item" data-toggle="dropdown">Products
<b class="caret"></b>
</a>
<div class="row">
<div class="col-md-6">
<div>
<ul>
<li>
product A
</li>
<li class="menu-li" wp-loop-skip>
product B
</li>
<li class="menu-li" wp-loop-skip>
product C
</li>
</ul>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</nav>
Thanks.
I am brand new to Bootstrap 3 and am trying to achieve a header that looks like the following:
As you can see there are several components here:
Logo; left-aligned
Menu items to the right of the logo
Message of the day (MOTD) in the top-right
"Hi, username!", right-aligned
"Envelope" Glyphicon to the left of the Username
"Heart" Glyphicon to the left of the Envelope Glyphicon (in the picture above it is a star but it should be a heart)
Here is my jsFiddle representing my best attempt, and here is the main <body> element of that fiddle:
<!DOCTYPE html>
<html>
<head>
<!-- Stuff goes here -->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Logo</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Menu 1 | Menu 2 | Menu 3</li>
<li class="active">This is the message of the day up here!</li>
<li class="active"><span class="glyphicon glyphicon-heart"></span></li>
<li class="active"><span class="glyphicon glyphicon-envelope"></span></li>
<li class="active">Hi, smeeb!</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
When I run this in jsFiddle, nothing is laid out properly and I can't even see most of the <li> elements. Any idea as to where I'm going awry?
Put the class "in" after the class "navbar-collapse" in the div with the id property "navbar".
With the class "in", your navbar will begin visible.
<!DOCTYPE html>
<html>
<head>
<!-- Stuff goes here -->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">Logo</a>
</div>
<div id="navbar" class="collapse navbar-collapse in">
<ul class="nav navbar-nav">
<li class="active">Menu 1 | Menu 2 | Menu 3</li>
<li class="active">This is the message of the day up here!</li>
<li class="active"><span class="glyphicon glyphicon-heart"></span></li>
<li class="active"><span class="glyphicon glyphicon-envelope"></span></li>
<li class="active">Hi, smeeb!</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
You can use this markup and style it according to your css. Make menus to left and others name and icons to right menu. then seperate the top message and position absolute it to the parent nav bar relative.
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Menu 1 </li>
<li class="active">Menu 2</li>
<li class="active">Menu </li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active"><span class="glyphicon glyphicon-heart"></span></li>
<li class="active"><span class="glyphicon glyphicon-envelope"></span></li>
<li class="active">Hi, smeeb!</li>
</ul>
</div>
<div>This is the message of the day up here!</div>
Ok, I run the risk of getting down voted here, but from a design perspective you could run into issues with the "quote of the day" in the navbar, especially when on smaller devices as things "scoot in".
Might I suggest having a top bar right above the nav?
<div class="top-bar-wrap">
<div class="container">
<div class="top-bar">
<div class="pull-right"> <!-- This will keep your quote to the right. Just change it to pull-left if if you want it to start from the left. -->
<p>Quote of the day</p>
</div>
</div>
</div>
</div>
Then you will be freed up to have your nav and icons next to the links. Just make sure to add "navbar-right" to your navbar holding your li items. You can add these gliphs in as li items if you'd like, or you can add them following the li with a -- display:inline -- property in your CSS and that should work. ALTHOUGH, might I suggest one more thing?
As a designer first that came to the dark side of development... the icons and code to display the username might also be best served in a bar just below your nav. You can duplicate the code for the "top-bar" section and place it just under your nav.
/* For the topbar above the nav */
.top-bar-wrap {
padding: 6px 0;
background-color: #333; }
.top-bar {
min-height: 20px;
line-height: 20px; }
/* For the bar just below the nav "Member-bar" */
.member-bar-wrap {
padding: 6px 0;
background-color: #333; }
.member-bar {
min-height: 20px;
line-height: 20px; }
<div class="member-bar-wrap">
<div class="container">
<div class="member-bar">
<div class="pull-right">
<!-- Gliphs and code for your member name display -->
</div>
</div>
</div>
</div>
That will keep everything nice and tidy... and you won't run into issues for smaller screens.
I'm trying to create a menu button, for my off canvas sidebar. I'm using the cannonstar:sidebar-bootstrap3 (AKA start bootstrap simple sidebar). http://ironsummitmedia.github.io/startbootstrap-simple-sidebar/
http://seegatesite.com/bootstrap/simple_sidebar_menu.html#
My problem is that it isn't working can anyone who willing to help me, look at my code please; thanks to all that help.
P.S. I'm using Meteor & Boostrap-3 with the iron-router package.
<div id="wrapper">
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">Home</li>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
<div id="page-content-wrapper">
<div class="page-content">
<nav class="navbar navbar-inverse navbar-default">
<div class="container-fluid">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" id="menu-toggle">
<i class="glyphicon glyphicon-menu-hamburger"></i>
</button>
<a class="navbar brand" href="#"></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><i class="glyphicon glyphicon-align-left"></i></li>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><i class="glyphicon glyphicon-search"></i></li>
<li>{{> loginButtons}}</li>
</ul>
</div>
</nav>
<header class="masthead">
<div class="container">
<h1></h1>
</div>
</header>
</div>
</div>
</div>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
$("#menu-toggle-2").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled-2");
});
Events are declared different in Meteor:
Assuming template name: <template name="honeybadger">..</template>
Template.honeybadger.events({
'click #menu-toggle': function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
}
}
Further Reading: Meteor documentation about Template events
Im planning on slidding 2 divs at the same time ,each one in opposite directions.How can i do this?
this is what i have tried
$("button").click(function () {
$(".cuadro").animate({ left: '250px', queue: false });
$("#R").animate({ left: '-250px', queue: false });
});
also if it's possible i can this to happend when my services tab is active instead of when the person click on the button.
<section id="services" class="content-section text-center">
<div class="services-section">
<div class="container">
<div class="col-lg-8 col-lg-offset-2">
<h2><span class="auto-style2">Services</span></h2>
<h2> </h2>
<h2><strong>Technlogies and lenguages used for software developing<br />
</strong></h2>
<p class="btn btn-default btn-lg">Download Resume</p>
<p> </p>
<button id="serv">serv</button>
</div>
<div class="col-lg-9">
<div class="cuadro" id="L"><h2 class="leng">C#</h2></div>
</div>
<div class="col-lg-3">
<div class="cuadro" id="R"><h2 class="leng">JavaScript</h2></div>
</div>
</div>
</div>
</section>
this is my nav bar
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav" id="tabs">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li>
HOME
</li>
<li>
<a class="page-scroll" href="#about">ABOUT</a>
</li>
<li>
<a class="page-scroll" href="#download">RESUME</a>
</li>
<li>
<a class="page-scroll" id="serTab" href="#services">SERVICES</a>
</li>
<li>
<a class="page-scroll" href="#contact">CONTACT</a>
</li>
</ul>
</div>
This should do it:
$('#tabs').tabs();
$('#serTab').click(function(){
$("#R").animate({left:'-=250px'});
$("#L").animate({left:'+=250px'});
});
Note that id="tabs" must be moved from the <ul> to its parent <div>
If that doesn't work, you may need event delegation. Try this:
$(document).on('click', '#serTab', function(){
$("#R").animate({left:'-=250px'});
$("#L").animate({left:'+=250px'});
});
Reference:
http://davidwalsh.name/event-delegate
I am having some trouble having a 'pull-right' element in a navbar remain on the same line as the menu. I've set it up in a jsfiddle.
Here's the general outline:
<div class="navbar navbar-inverse navbar-fixed-top hidden-print">
<div class="navbar-inner">
<div class="container">
<ul class="nav nav-pills">
<li>....</li>
</ul>
<div class="pull-right">
<ul class="nav pull-right">
<li>....</li>
.... and so on
Ideally the menu items, and user dropdown would be on the same line. The menu bar should have its height determined by the button sizes.
You need to pull-left the list:
<ul class="nav nav-pills pull-left">