使用导航菜单更改内容容器

时间:2015-07-05 21:47:36

标签: jquery html css twitter-bootstrap containers

我有一个导航菜单,当您单击某个选项时,我希望它将我的内容容器更改为其他内容容器,或者只显示相应的内容容器。我的目标是将除内容容器之外的多个页面合并到一个页面中。

1 个答案:

答案 0 :(得分:1)

 $('.option-toggle-selector').on('click', function() {
      $('.my-content-container-selector').replaceWith(otherContainerElement);
 });

otherCotainerElement可以是jquery元素,也可以只是硬编码的html字符串。我认为你在这里问的关键功能是replaceWith:http://api.jquery.com/replacewith/