I Have developed a page where it has a navigation bar with some buttons and hyper links when i click the login hyper link it should open the modal it’s opening but giving some issue . it opening multiple times. unable to find the cause
When click the signup hyperlink it open the modal multiple times. please refer the image for how it looks.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml: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 -->
<meta name="description" /><meta name="author" /><title>
Home Page
</title>
<!-- Bootstrap core CSS -->
<link href="Styles/bootstrap.min.css" rel="stylesheet" />
<!-- Custom styles for this template -->
<link href="Styles/navbar-fixed-top.css" rel="stylesheet" />
<script> (function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=361718050699028";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));</script>
</head>
<body>
<div class="page">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="#">Project name</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#Home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li> <a href="#"
data-toggle="modal"
data-target="#basicModal1">LogIn</a><li>
<li> <a href="#"
data-toggle="modal"
data-target="#basicModal">SignUp</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<div class="main">
<div class="container">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Owl Carousel - Images Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="jQuery Responsive Carousel - Owl Carusel">
<meta name="author" content="Bartosz Wojciechowski">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,600,700' rel='stylesheet' type='text/css'>
<link href="assets/css/bootstrapTheme.css" rel="stylesheet">
<link href="assets/css/custom.css" rel="stylesheet">
<!-- Owl Carousel Assets -->
<link href="Scripts/owl-carousel/owl.carousel.css" rel="stylesheet">
<link href="Scripts/owl-carousel/owl.theme.css" rel="stylesheet">
<!-- Prettify -->
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<link rel="shortcut icon" href="assets/ico/favicon.png">
</head>
<body>
<div id="title">
<div class="container">
<div class="row">
<div class="span12">
<h1>Content with Images</h1>
</div>
</div>
</div>
</div>
<div id="demo">
<div class="container">
<div class="row">
<div class="span12">
<div id="owl-demo" class="owl-carousel">
<div class="item"><img src="assets/owl1.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl2.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl3.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl4.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl5.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl6.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl7.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl8.jpg" alt="Owl Image"></div>
</div>
</div>
</div>
</div>
</div>
<div data-spy="scroll" data-target=".navbar" data-offset="12" class="test">
<div id="Home">
<div class="container-fluid">
<h1>Section 1</h1>
<p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
<p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
</div>
</div>
<div id="about">
<div class="container-fluid">
<h1>Section 2</h1>
<p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
<p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
</div>
</div>
<div id="contact">
<div class="container-fluid">
<h1>Section 3</h1>
<p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
<p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
</div>
</div>
</div>
<div id="example-info">
<div class="container">
<div class="row">
<div class="span12">
<h1>Setup</h1>
<p>In order for the images to auto fit to slider containers use width 100% on <img>. Check CSS below</p>
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#javascript">Javascript</a></li>
<li><a href="#HTML">HTML</a></li>
<li><a href="#CSS">CSS</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="javascript">
<pre class="pre-show prettyprint linenums">
$(document).ready(function() {
$("#owl-demo").owlCarousel({
autoPlay: 3000, //Set AutoPlay to 3 seconds
items : 4,
itemsDesktop : [1199,3],
itemsDesktopSmall : [979,3]
});
});
</pre>
</div>
<div class="tab-pane" id="HTML">
<pre class="pre-show prettyprint linenums">
<div id="owl-demo">
<div class="item"><img src="assets/owl1.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl2.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl3.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl4.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl5.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl6.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl7.jpg" alt="Owl Image"></div>
<div class="item"><img src="assets/owl8.jpg" alt="Owl Image"></div>
</div>
</pre>
</div>
<div class="tab-pane" id="CSS">
<pre class="pre-show prettyprint linenums">
#owl-demo .item{
margin: 3px;
}
#owl-demo .item img{
display: block;
width: 100%;
height: auto;
}
</pre>
</div>
</div><!--End Tab Content-->
</div>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<div class="row">
<div class="span12">
<h5>Bartosz Wojciechowski 2013 / @OwlFonk /
<a href="mailto:[email protected]?subject=Hey Owl!">email</a> /
<a href="../changelog.html">changelog</a> /
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EFSGXZS7V2U9N">donate</a> /
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://owlgraphic.com/owlcarousel/" data-text="Awesome jQuery Owl Carousel Responsive Plugin" data-via="OwlFonk" data-count="none" data-hashtags="owlcarousel"></a>
<script>
var owldomain = window.location.hostname.indexOf("owlgraphic");
if (owldomain !== -1) {
!function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + '://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); } } (document, 'script', 'twitter-wjs');
}
</script>
</h5>
</div>
</div>
</div>
</div>
<script src="assets/js/jquery-1.9.1.min.js"></script>
<script src="Scripts/owl-carousel/owl.carousel.js"></script>
<!-- Demo -->
<style>
#owl-demo .item{
margin: 3px;
}
#owl-demo .item img{
display: block;
width: 100%;
height: auto;
}
</style>
<script>
jQuery(document).ready(function ($) {
$("#owl-demo").owlCarousel({
autoPlay: 3000,
items: 4,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [979, 3]
});
});
</script>
<script src="assets/js/bootstrap-collapse.js"></script>
<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="assets/js/application.js"></script>
</body>
</html>
</div>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
</body>
</html>
2
Answers
In addition to including bootstrap.min.js you have also included bootstrap-collapse.js (and bootstrap-transition.js and bootstrap-tab.js too).
Just retain bootstrap.min.js (it contains the other 3) and remove the other bootstrap-*.js files.
Note – you also have seem to have jQuery repeated.
Firstly: You have two lots and snippets in your code.
Secondly: There is no need to call additional bootstrap JS documents as you already call the main bootstrap.min.js file.