我尝试建立从<a>
到<div>
的链接,但我无法建立此链接。在代码中你可以看到目的地如何在/ div / div / div / div / div /中。当我链接到一个我没有问题的部分,但在这种情况下,我无法做到。我使用bootstrap中的两种样式。
我会建立从<a href="#tabmotora" ...>LEE MÁS</a>
到<div class="tab-pane fade" id="tabmotora"><section id="tabmotorasec"...>
的链接。我该怎么办?
我的HTML:
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Solutions</title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<!-- Plugin CSS -->
<link href="vendor/magnific-popup/magnific-popup.css" rel="stylesheet">
<!-- Theme CSS -->
<link href="css/creative.min.css" rel="stylesheet">
<link href="css2/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css2/modern-business.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css2/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
</button>
<a class="navbar-brand page-scroll" href="index.html">Oiko Tec</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a class="page-scroll" href="about.html">Equipo</a>
</li>
<li>
<a class="page-scroll" href="premios.html">Trayectoria</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Catálogo <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="productos.html">Productos</a>
</li>
<li>
<a href="#page-top">Servicios</a>
</li>
<li>
<a href="serviciosadicionales.html">Servicios Adicional</a>
</li>
</ul>
</li>
<li>
<a href="contact.html">Contacta</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<section class="bg-primary" id="about" style="background-color:#FAAC58; padding: 0px;" class="clear_fix">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Servicios
<!--<small>Equipo</small>-->
</h1>
<ol class="breadcrumb">
<li><a href="index.html"><b>Home</b></a>
</li>
<li class="active"><b>Servicios</b></li>
</ol>
</div>
</div>
</div>
</section>
<section id="texto-top" style="padding: 30px;">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Servicios para huéspedes</h2>
<p>...................................................................................................................</p>
</div>
</div>
</div>
</section>
<section id="tipos" class="bg-primary" style="background-color:#FAAC58; padding: 0px;" class="clear_fix">
<div class="container" style="background-color:#FAAC58; color:#000">
<div class="row">
<div class="col-lg-12">
<h2 class="page-header" style="color:#FFF">Panel de Servicios</h2>
</div>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default text-center">
<div class="panel-body">
<span class="fa-stack fa-5x">
<i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-low-vision fa-stack-1x fa-inverse" style="color:#D18A58"></i>
</span>
</div>
<div class="panel-heading">
<h4>Discapacidad Visual</h4>
<p>Guía virtual interactivo para orientarte en las instalaciones hotel.</p>
<a href="#tabvisual" class="btn btn-default">LEE MÁS</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default text-center">
<div class="panel-body">
<span class="fa-stack fa-5x">
<i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-wheelchair fa-stack-1x fa-inverse" style="color:#D18A58"></i>
<!-- <i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-car fa-stack-1x fa-inverse" style="color:#D18A58"></i>-->
</span>
</div>
<div class="panel-heading">
<h4>Discapacidad motora</h4>
<p>Control por voz de las instalaciones a través de tu smartphone.</p>
<a href="#tabmotora" class="btn btn-default" >LEE MÁS</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default text-center">
<div class="panel-body">
<span class="fa-stack fa-5x">
<i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-deaf fa-stack-1x fa-inverse" style="color:#D18A58"></i>
</span>
</div>
<div class="panel-heading">
<h4>Discapacidad Auditiva</h4>
<p>Sistema de seguridad por alertas en tu móvil y pulsera vibratoria.</p>
<a href="#tabauditiva" class="btn btn-default">LEE MÁS</a>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="categorias" style="padding: 30px;">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2 class="page-header">Tabs de servicios</h2>
</div>
<div class="col-lg-12">
<ul id="myTab" class="nav nav-tabs nav-justified">
<li class="active"><a href="#tabvisual" data-toggle="tab"><i class="fa fa-low-vision"></i> Discapacidad Visual</a>
</li>
<li class=""><a href="#tabmotora" data-toggle="tab"><i class="fa fa-wheelchair"></i> Discapacidad Motora</a>
</li>
<li class=""><a href="#tabauditiva" data-toggle="tab"><i class="fa fa-deaf"></i> Discapacidad auditiva</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="tabvisual">
<h4></h4></br>
<p>...................................................................................................................</p>
</div>
<div class="tab-pane fade" id="tabmotora"><section id="tabmotorasec" style="padding:0px; border: 0px; ">
<h4></h4></br>
<p>...................................................................................................................</p>
</div>
<div class="tab-pane fade" id="tabauditiva">
<h4></h4></br>
<p>...................................................................................................................</p>
</div>
</div>
</div>
</div>
</div>
</section>
谢谢!
答案 0 :(得分:0)
通过添加 data-toggle="tab"
:
<a href="#tabmotora" data-toggle="tab" class="btn btn-default">LEE MÁS</a>
并添加javascript:
<script type="text/javascript">
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = this.href.split('#');
$('.nav a').filter('a[href="#'+target[1]+'"]').tab('show');
})
</script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
</button>
<a class="navbar-brand page-scroll" href="index.html">Oiko Tec</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a class="page-scroll" href="about.html">Equipo</a>
</li>
<li>
<a class="page-scroll" href="premios.html">Trayectoria</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Catálogo <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="productos.html">Productos</a>
</li>
<li>
<a href="#page-top">Servicios</a>
</li>
<li>
<a href="serviciosadicionales.html">Servicios Adicional</a>
</li>
</ul>
</li>
<li>
<a href="contact.html">Contacta</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<section class="bg-primary" id="about" style="background-color:#FAAC58; padding: 0px;" class="clear_fix">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Servicios
<!--<small>Equipo</small>-->
</h1>
<ol class="breadcrumb">
<li><a href="index.html"><b>Home</b></a>
</li>
<li class="active"><b>Servicios</b></li>
</ol>
</div>
</div>
</div>
</section>
<section id="texto-top" style="padding: 30px;">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Servicios para huéspedes</h2>
<p>...................................................................................................................</p>
</div>
</div>
</div>
</section>
<section id="tipos" class="bg-primary" style="background-color:#FAAC58; padding: 0px;" class="clear_fix">
<div class="container" style="background-color:#FAAC58; color:#000">
<div class="row">
<div class="col-lg-12">
<h2 class="page-header" style="color:#FFF">Panel de Servicios</h2>
</div>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default text-center">
<div class="panel-body">
<span class="fa-stack fa-5x">
<i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-low-vision fa-stack-1x fa-inverse" style="color:#D18A58"></i>
</span>
</div>
<div class="panel-heading">
<h4>Discapacidad Visual</h4>
<p>Guía virtual interactivo para orientarte en las instalaciones hotel.</p>
<a href="#tabvisual" class="btn btn-default">LEE MÁS</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default text-center">
<div class="panel-body">
<span class="fa-stack fa-5x">
<i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-wheelchair fa-stack-1x fa-inverse" style="color:#D18A58"></i>
<!-- <i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-car fa-stack-1x fa-inverse" style="color:#D18A58"></i>-->
</span>
</div>
<div class="panel-heading">
<h4>Discapacidad motora</h4>
<p>Control por voz de las instalaciones a través de tu smartphone.</p>
<a href="#tabmotora" data-toggle="tab" class="btn btn-default">LEE MÁS</a>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="panel panel-default text-center">
<div class="panel-body">
<span class="fa-stack fa-5x">
<i class="fa fa-circle fa-stack-2x text-primary" style="color:#FFF"></i>
<i class="fa fa-deaf fa-stack-1x fa-inverse" style="color:#D18A58"></i>
</span>
</div>
<div class="panel-heading">
<h4>Discapacidad Auditiva</h4>
<p>Sistema de seguridad por alertas en tu móvil y pulsera vibratoria.</p>
<a href="#tabauditiva" class="btn btn-default">LEE MÁS</a>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="categorias" style="padding: 30px;">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2 class="page-header">Tabs de servicios</h2>
</div>
<div class="col-lg-12">
<ul id="myTab" class="nav nav-tabs nav-justified">
<li class="active"><a href="#tabvisual" data-toggle="tab"><i class="fa fa-low-vision"></i> Discapacidad Visual</a>
</li>
<li class=""><a href="#tabmotora" data-toggle="tab"><i class="fa fa-wheelchair"></i> Discapacidad Motora</a>
</li>
<li class=""><a href="#tabauditiva" data-toggle="tab"><i class="fa fa-deaf"></i> Discapacidad auditiva</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="tabvisual">
<h4></h4></br>
<p>...................................................................................................................</p>
</div>
<div class="tab-pane fade" id="tabmotora"><section id="tabmotorasec" style="padding:0px; border: 0px; ">
<h4></h4></br>
<p>...................................................................................................................</p>
</div>
<div class="tab-pane fade" id="tabauditiva">
<h4></h4></br>
<p>...................................................................................................................</p>
</div>
</div>
</div>
</div>
</div>
</section>
<script type="text/javascript">
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = this.href.split('#');
$('.nav a').filter('a[href="#'+target[1]+'"]').tab('show');
})
</script>
&#13;