<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<!-- Static navbar -->
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-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="#">Project name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="blog dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="false">Blog <b class="caret"></b></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 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 class="active"><a href="./">Default</a></li>
<li><a href="../navbar-static-top/">Static top</a></li>
<li><a href="../navbar-fixed-top/">Fixed top</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</body>
</html>
/* ---- Supports Touch ---- */
/* Detects touch support and adds appropriate classes to html and returns a JS object
* Copyright (c) 2013 Izilla Partners Pty Ltd
* http://www.izilla.com.au
* Licensed under the MIT license
* https://coderwall.com/p/egbgdw
*/
var supports = (function () {
var a = document.documentElement,
b = "ontouchstart" in window || navigator.msMaxTouchPoints;
if (b) {
a.className += " touch";
return {
touch: true
}
} else {
a.className += " no-touch";
return {
touch: false
}
}
})();
// ------ trigger on no-touch only
if ($("html").hasClass("no-touch")) {
/*
* Project: Bootstrap Hover Dropdown
* Author: Cameron Spear
* Contributors: Mattia Larentis
*
* Dependencies: Bootstrap's Dropdown plugin, jQuery
*
* A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice user experience.
*
* License: MIT
*
* http://cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/
*/
(function (e, t, n) {
if ("ontouchstart" in document) return;
var r = e();
e.fn.dropdownHover = function (n) {
r = r.add(this.parent());
return this.each(function () {
var i = e(this),
s = i.parent(),
o = {
delay: 500,
instantlyCloseOthers: !0
}, u = {
delay: e(this).data("delay"),
instantlyCloseOthers: e(this).data("close-others")
}, a = e.extend(!0, {}, o, n, u),
f;
s.hover(function (n) {
if (!s.hasClass("open") && !i.is(n.target)) return !0;
a.instantlyCloseOthers === !0 && r.removeClass("open");
t.clearTimeout(f);
s.addClass("open");
s.trigger(e.Event("show.bs.dropdown"))
}, function () {
f = t.setTimeout(function () {
s.removeClass("open");
s.trigger("hide.bs.dropdown")
}, a.delay)
});
i.hover(function () {
a.instantlyCloseOthers === !0 && r.removeClass("open");
t.clearTimeout(f);
s.addClass("open");
s.trigger(e.Event("show.bs.dropdown"))
});
s.find(".dropdown-submenu").each(function () {
var n = e(this),
r;
n.hover(function () {
t.clearTimeout(r);
n.children(".dropdown-menu").show();
n.siblings().children(".dropdown-menu").hide()
}, function () {
var e = n.children(".dropdown-menu");
r = t.setTimeout(function () {
e.hide()
}, a.delay)
})
})
})
};
e(document).ready(function () {
e('[data-hover="dropdown"]').dropdownHover()
})
})(jQuery, this);
// LINKS
$(".dropdown > .blog").on('click', function () {
window.location = "http://www.google.com/";
});
}
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |