小SEO友好 选项卡式内容插件 jQuery语义选项卡

  • 源码大小:7.13KB
  • 所需积分:1积分
  • 源码编号:19JP-3608
  • 浏览次数:494次
  • 最后更新:2023年07月01日
  • 所属栏目:其他
我要下载
加入收藏
本站默认解压密码:19jp.com 或 19jp_com

简介

选项卡可以是一种非常有效的界面设计技术。如果使用正确,选项卡可以帮助用户立即找到他们要查找的信息。

如今,许多网站使用语义HTML标签,如无序列表和标题元素,为搜索引擎爬虫提供更好的信息,同时仍然让用户可以轻松导航网站。

这是一个语义标签jQuery插件,可以将任何一组语义HTML标签转换为漂亮的、基于标签的导航元素。它通过使用<h3>,<ul><p>标签,帮助搜索引擎更好地对您的内容进行分类。

如何使用它:

1.使用创建选项卡导航<h3>标记并将选项卡式内容插入<p>标签如下:

  1. <div id="semantic-tabs">
  2.  
  3. <h3>Tab 1</h3>
  4. <p>This is the content of Tab 1.</p>
  5. ... more tab 1 content
  6.  
  7. <h3>Tab 1</h3>
  8. <p>This is the content of Tab 2.</p>
  9. ... more tab 2 content
  10.  
  11. <h3>Tab 3</h3>
  12. <p>This is the content of Tab 3.</p>
  13. ... more tab 3 content
  14.  
  15. </div>

2.在文档末尾加载jQuery库和语义标签插件。

  1. <script src="/path/to/cdn/jquery.slim.min.js"></script>
  2. <script src="/path/to/jquery.semantic-tabs.min.js"></script>

3.调用函数语义选项卡在顶部容器上。

  1. $('#semantic-tabs').semanticTabs({
  2. // options here
  3. });

4.将您自己的CSS样式应用于选项卡组件。

  1. #semantic-tabs {
  2. border: 1px solid #555;
  3. }
  4.  
  5. #semantic-tabs-heads {
  6. display: flex;
  7. list-style: none;
  8. margin: 0;
  9. padding: 0;
  10. }
  11.  
  12. #semantic-tabs-heads {
  13. background: #555;
  14. }
  15.  
  16. #semantic-tabs-heads li {
  17. color: #fff;
  18. cursor: pointer;
  19. padding: 10px 15px;
  20. }
  21.  
  22. #semantic-tabs-heads li.active {
  23. color: #000;
  24. background: #fff;
  25. }

5.覆盖默认选择器。

  1. $('#semantic-tabs').semanticTabs({
  2. componentClass: 'semantic-tabs-component',
  3. head: 'h3',
  4. headsID: 'semantic-tabs-heads'
  5. });

预览截图