Well, i'm trying to using bootstrap with JSF Project. I'm using this bootstrap layout : http://startbootstrap.com/template-overviews/sb-admin-2/.
So, i'm trying to import the metisMenu but without success, see:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Projeto A</title>
<h:outputStylesheet library="js" name="bootstrap-3.3.2-dist/css/bootstrap.min.css" />
<h:outputStylesheet library="js" name="metisMenu/metisMenu.min.css" />
<h:outputStylesheet library="css" name="sb-admin-2.css" />
<h:outputScript library="js" name="jquery-2.1.3.min.js" />
<h:outputScript library="js" name="bootstrap-3.3.2-dist/js/bootstrap.min.js" />
<h:outputScript library="js" name="metisMenu/metisMenu.min.js" />
<h:outputScript library="js" name="sb-admin-2.js" />
</h:head>
<body>
</body>
</html>
INside body i have a peace of side-menu
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search..." />
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
<!-- /input-group -->
But i got following error on Browser Console:
Uncaught TypeError: undefined is not a function in $('#side-menu').metisMenu()
See my JS:
$(function() {
$('#side-menu').metisMenu();
});
//Loads the correct sidebar on window load,
//collapses the sidebar on window resize.
// Sets the min-height of #page-wrapper to window size
$(function() {
$(window).bind("load resize", function() {
topOffset = 50;
width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width;
if (width < 768) {
$('div.navbar-collapse').addClass('collapse');
topOffset = 100; // 2-row-menu
} else {
$('div.navbar-collapse').removeClass('collapse');
}
height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1;
height = height - topOffset;
if (height < 1) height = 1;
if (height > topOffset) {
$("#page-wrapper").css("min-height", (height) + "px");
}
});
var url = window.location;
var element = $('ul.nav a').filter(function() {
return this.href == url || url.href.indexOf(this.href) == 0;
}).addClass('active').parent().parent().addClass('in').parent();
if (element.is('li')) {
element.addClass('active');
}
});