-1
the problem and when editing "in the browser url bar" I have to press 2x enter to load the desired page... and it should only be with 1x enter
the other problem is that it has since error:0 when navigating... I do not understand why...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">Project name</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a class="tc" href="#home" data-url="a_teste.php" data-info="GET">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">Dropdown <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="nav-header">Nav header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div id="conteudo">
<!-- /carrega as informaçoes -->
</div>
<!-- Placed at the end of the document so the pages load faster -->
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
$(document).ready(function(){
// faz load via url
var hash = window.location.hash;
var hashman = $(".tc[href='"+hash+"']").attr("data-url");
var hashman_tipo = $(".tc[href='"+hash+"']").attr("data-info");
if (typeof hashman !== "undefined") {
loading(1);
navegacao(hashman,hashman_tipo);
}else {
loading(1);
navegacao("a_teste.php","GET");
}
// faz load via link
$(".tc").click(function(){
$("#conteudo").fadeOut('slow',function(){ $("#conteudo").fadeIn(loading(1)); } )
var link = $(this).attr("data-url");
var tipo = $(this).attr("data-info");
navegacao(link,tipo);
});
function navegacao(link,tipo){
$.ajax({
url : link,
dataType : "HTML", // Pode ser SCRIPT se o retorno for somente comandos JavaScript
type : tipo, // Pode ser get ou post..
success : function(conteudo){
$("#conteudo").hide().html(conteudo).fadeIn('slow');
},
error : function(a,b,c){
alert("Erro : "+a["status"]+" "+c);
}
});
}
function loading(status) {
if ( status == 1 )
$('#conteudo').html("<div id='loading'><br><br><center><img src='assets/img/load.gif' border='0' /></center></div>");
else
$('#loading').fadeOut();
}
});
</script>
</body>
</html>
Let’s go continue this discussão in chat.
– brasofilo