jquery - 直接链接到选项卡式内容 - jquery 选项卡

标签 jquery css tabs responsive

我的页面位于此处 - http://hoffwebsites.com/mcwp-2/buy-by-industry/printing/

基本上,我想直接链接到我的标签内容。

它说的是:UV 固化喷墨、喷墨、水性喷墨、数字点播、丝网打印、柔版打印、凹版打印、平版胶印、热转印、激光打印

我想向用户提供一个链接,该链接会将他们带到此页面,但会打开一个特定的选项卡,而不是默认情况下的“UV 固化喷墨打印机”。因此,如果我希望有人在到达此页面后立即看到“热转印”选项卡打开,我需要能够直接链接到该选项卡,但我无法弄清楚。

那些链接有类和数据标签,例如:

<a class="projects_select tab-link" data-tab="tab-3">Aqueous Inkjet</a>

但我不知道如何将它直接链接到“UV-cure inkjet”或“Offset Lithography”等。

请帮忙?

这是我的代码。

<h1 class="entry-title" style="color: #1c437f; margin-top: -0px;">Printing</h1>
<h2>UV Cure Inkjet Printing on Tyvek&#174; Graphics Media</h2>
See all Tyvek&#174; Graphic media styles offered by Material Concepts that are compatible with the UV cure inkjet printing process:<br />
<img src="http://hoffwebsites.com/mcwp-2/wp-content/uploads/2018/08/spacer-line.gif">
<style type="text/css">tbody tr:nth-child(odd) {background-color: #f9f9f9;}</style>
<br class="clear"><a name="Top"></a><a class="projects_select tab-link current" data-tab="tab-1">UV-cure inkjet</a><a class="projects_select tab-link" data-tab="tab-2">Inkjet</a><a class="projects_select tab-link" data-tab="tab-3">Aqueous Inkjet</a><a class="projects_select tab-link" data-tab="tab-4">Digital on Demand</a><a class="projects_select tab-link" data-tab="tab-5">Screen Process</a><br class="clear">
<div id="tab-1" class="tab-content current">
<h2 style="margin-top: 10px; margin-bottom: 25px;">UV-cure inkjet</h2>
<table align="center" style="font-family: arial !important; font-size: 13px; border: 1px solid #aed0ea; margin-bottom: -30px;" border="1" cellpadding="3" cellspacing="3" width="100%" role="table">
<thead role="rowgroup">
<tr role="row">
<td style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3;
 text-align: center;"><b>Product</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Coating</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Thickness</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Weight</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Core</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Notes</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Typical Applications</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Widths</b></td>
</tr>
</thead>
<tbody role="rowgroup">
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1025D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">5 mil</td>
<td  role="cell">1.25 oz/yd2&#44; [42 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Templates for sign installation. Texturing for in-store visual appeal</td>
<td  role="cell">36&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1056D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">6.3 mil</td>
<td  role="cell">1.6 oz/yd2&#44; [54 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Reprographics&#44; Tags &#038; Labels&#44; Signs</td>
<td  role="cell">36&#34;&#44; 60.25&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1073D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.5 mil</td>
<td  role="cell">2.2 oz/yd2&#44; [75 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Reprographics&#44; Booklets&#44; Charts&#44; &#038; Signs&#44; Blueprints</td>
<td  role="cell">36&#34;&#44; 61&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1079</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.9 mil</td>
<td  role="cell">2.85 oz/yd2&#44; [97 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Tags &#038; Labels</td>
<td  role="cell">36&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1085D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">10.3 mil</td>
<td  role="cell">3.2 oz/yd2&#44; [109 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Banners &#038; Signs. Extra body for shape development.</td>
<td  role="cell">57.125&#34;&#44; 114.25&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1443R</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">5.5 mil</td>
<td  role="cell">1.25 oz/yd2&#44; [43 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Fabric-like&#44; Soft Structure</td>
<td  role="cell">Promotional clothing&#44; Ideal for interlining between double sided signs&#44; flags&#44; and banners</td>
<td  role="cell">60&#34;&#44; 120&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">8740D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.5 mil</td>
<td  role="cell">2.0 oz/yd2&#44; [68 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Reprographics&#44; Booklets&#44; Charts&#44; &#038; Signs&#44; Blueprints</td>
<td  role="cell">36&#34;&#44; 48&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Sheets</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.5 mil</td>
<td  role="cell">2.0 oz/yd2&#44; [68gsm]</td>
<td  role="cell">NA</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Water resistent paper items like signage&#44; racing bibs&#44; etc.</td>
<td  role="cell">8.5&#34;x11&#34;&#44; 12&#215;18</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Sheets</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">6.3 mil</td>
<td  role="cell">1.6 oz/yd2&#44; [54 gsm]</td>
<td  role="cell">NA</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Water resistent paper items like signage&#44; racing bibs&#44; etc.</td>
<td  role="cell">8.5&#34; x 11&#34;</td>
</tr>
</tbody>
</table>
</div>
<div id="tab-2" class="tab-content">
<h2 style="margin-top: 10px; margin-bottom: 25px;">Inkjet</h2>
<table align="center" style="font-family: arial !important; font-size: 13px; border: 1px solid #aed0ea; margin-bottom: -30px;" border="1" cellpadding="3" cellspacing="3" width="100%" role="table">
<thead role="rowgroup">
<tr role="row">
<td style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3;
 text-align: center;"><b>Product</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Coating</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Thickness</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Weight</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Core</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Notes</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Typical Applications</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Widths</b></td>
</tr>
</thead>
<tbody role="rowgroup"></tbody>
</table>
</div>
<div id="tab-3" class="tab-content">
<h2 style="margin-top: 10px; margin-bottom: 25px;">Aqueous Inkjet</h2>
<table align="center" style="font-family: arial !important; font-size: 13px; border: 1px solid #aed0ea; margin-bottom: -30px;" border="1" cellpadding="3" cellspacing="3" width="100%" role="table">
<thead role="rowgroup">
<tr role="row">
<td style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3;
 text-align: center;"><b>Product</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Coating</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Thickness</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Weight</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Core</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Notes</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Typical Applications</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Widths</b></td>
</tr>
</thead>
<tbody role="rowgroup">
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Inkjet 11 Mil</a></td>
<td  role="cell">Coated 1 side</td>
<td  role="cell">11 mil</td>
<td  role="cell">4 oz/yd2&#44; [136 gsm]</td>
<td  role="cell">2&#34;</td>
<td  role="cell">Non-glare surface&#44; Paper-like</td>
<td  role="cell">Banners &#038; Signs</td>
<td  role="cell">24&#34;&#44; 36&#34;&#44; 42&#34;&#44; 50&#34;&#44; 59&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Inkjet 7 Mil</a></td>
<td  role="cell">Coated 1 side</td>
<td  role="cell">7 mil</td>
<td  role="cell">1.8 oz/yd2&#44; [61 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Non-glare surface&#44; Paper-like</td>
<td  role="cell">Banners &#038; Signs</td>
<td  role="cell">36&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Sheets</a></td>
<td  role="cell">Coated 1 side</td>
<td  role="cell">8 mil</td>
<td  role="cell">2.2 oz/yd2&#44; [68 gsm]</td>
<td  role="cell">NA</td>
<td  role="cell">Non-glare surface&#44; Paper-like</td>
<td  role="cell">Water resistent paper items like signage&#44; racing bibs&#44; etc.</td>
<td  role="cell">8.5&#34; x 11&#34;</td>
</tr>
</tbody>
</table>
</div>
<div id="tab-4" class="tab-content">
<h2 style="margin-top: 10px; margin-bottom: 25px;">Digital on Demand</h2>
<table align="center" style="font-family: arial !important; font-size: 13px; border: 1px solid #aed0ea; margin-bottom: -30px;" border="1" cellpadding="3" cellspacing="3" width="100%" role="table">
<thead role="rowgroup">
<tr role="row">
<td style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3;
 text-align: center;"><b>Product</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Coating</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Thickness</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Weight</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Core</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Notes</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Typical Applications</b></td>
<th style="padding: 8px; color: white; border-color: #aed0ea; background-color: #3baae3; text-align: center;"  role="columnheader"><b>Widths</b></td>
</tr>
</thead>
<tbody role="rowgroup">
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1025D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">5 mil</td>
<td  role="cell">1.25 oz/yd2&#44; [42 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Templates for sign installation. Texturing for in-store visual appeal</td>
<td  role="cell">36&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1056D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">6.3 mil</td>
<td  role="cell">1.6 oz/yd2&#44; [54 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Reprographics&#44; Tags &#038; Labels&#44; Signs</td>
<td  role="cell">36&#34;&#44; 60.25&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1073D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.5 mil</td>
<td  role="cell">2.2 oz/yd2&#44; [75 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Reprographics&#44; Booklets&#44; Charts&#44; &#038; Signs&#44; Blueprints</td>
<td  role="cell">36&#34;&#44; 61&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1079</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.9 mil</td>
<td  role="cell">2.85 oz/yd2&#44; [97 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Tags &#038; Labels</td>
<td  role="cell">36&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">1085D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">10.3 mil</td>
<td  role="cell">3.2 oz/yd2&#44; [109 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Banners &#038; Signs. Extra body for shape development.</td>
<td  role="cell">57.125&#34;&#44; 114.25&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">8740D</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.5 mil</td>
<td  role="cell">2.0 oz/yd2&#44; [68 gsm]</td>
<td  role="cell">3&#34;</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Reprographics&#44; Booklets&#44; Charts&#44; &#038; Signs&#44; Blueprints</td>
<td  role="cell">36&#34;&#44; 48&#34;</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Sheets</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">7.5 mil</td>
<td  role="cell">2.0 oz/yd2&#44; [68gsm]</td>
<td  role="cell">NA</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Water resistent paper items like signage&#44; racing bibs&#44; etc.</td>
<td  role="cell">8.5&#34;x11&#34;&#44; 12&#215;18</td>
</tr>
<tr role="row">
<td  role="cell"><a href="http://hoffwebsites.com/mcwp-2/">Tyvek Sheets</a></td>
<td  role="cell">Uncoated</td>
<td  role="cell">6.3 mil</td>
<td  role="cell">1.6 oz/yd2&#44; [54 gsm]</td>
<td  role="cell">NA</td>
<td  role="cell">Paper-like&#44; Hard Structure</td>
<td  role="cell">Water resistent paper items like signage&#44; racing bibs&#44; etc.</td>
<td  role="cell">8.5&#34; x 11&#34;</td>
</tr>
</tbody>
</table>
</div>

<script src='http://hoffwebsites.com/mcwp-2/1-data/responsive-tabbed-content-with-jquery-and-css/js/jquery.min.js'></script>
<script src='http://hoffwebsites.com/mcwp-2/1-data/responsive-tabbed-content-with-jquery-and-css/js/index.js'></script>
</body><br />
</html><center><b><a href="#Top">Back to Top</a></b></center><script src="http://hoffwebsites.com/mcwp-2/1-data/responsive-tabbed-content-with-jquery-and-css/js/modernizr.min.js" type="text/javascript"></script>
<style type="text/css">ol,ul{list-style:none}</style>
<link rel="stylesheet" href="http://hoffwebsites.com/mcwp-2/1-data/responsive-tabbed-content-with-jquery-and-css/css/style.css">

最佳答案

这是我会做的:

1) 使用 url 中的参数构建链接,如下所示:

http://hoffwebsites.com/mcwp-2/buy-by-industry/printing/?tab=tab-9

2) 然后在点击函数上面添加你的js:

$(document).ready(function(){

  $.urlParam = function(name){
    var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
    if (results==null){
       return null;
    }
    else{
       return results[1] || 0;
    }
  };

  var tab = $.urlParam('tab');

  if (tab != null) {
    $('.projects_select').removeClass('current');
    $('.tab-content').removeClass('current');

    $('.projects_select[data-tab="' + tab + '"]').addClass('current');
    $("#"+tab).addClass('current');
  };

    $('.projects_select').click(function(){
        var tab_id = $(this).attr('data-tab');

        $('.projects_select').removeClass('current');
        $('.tab-content').removeClass('current');

        $(this).addClass('current');
        $("#"+tab_id).addClass('current');
    });

})

如果有帮助,请告诉我!

关于jquery - 直接链接到选项卡式内容 - jquery 选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52860203/

相关文章:

jquery datepicker spring mvc 日期格式

javascript - 我需要在 "//callback code"处填写什么才能使 Mailcheck 正常工作? (jquery 用法)

javascript - 如何使用 Tailwind 在 NextJS 中添加动态背景?

apache-flex - flex 3 中的滚动标签

ios - 如何将 TabBar 图像添加到每个选项卡?在 XCode 8.1 上

html - 水平滚动 Bootstrap 4 导航选项卡

javascript - 纯 Javascript 中的 jQuery 代码

javascript - ajax页面加载内容后加载jquery插件js

javascript - 在我的窗口屏幕外停止动画

javascript - 是否有一个 UI 框架来模拟 Mac 应用程序的外观?