首页 > 解决方案 > 使用 javascript 插件包含页脚

问题描述

所以我在 index.html 中包含了一个页脚,并且我有 footer.html 文件。唯一的问题是我使用了tippy工具提示插件,当我有没有包含功能的页脚时,它在页脚中工作,但是当我包含它时,插件不再工作。

    <script>
$(function(){
  $("#footer").load("footer.html"); 
});
</script>


<div id="footer"></div>

<div class="footer-copyright">
            <span>&copy; Lancashire Roleplay Community 2019 - All rights reserved</span>
            <span class="footerDev">Website Developed by <a href="mailto:mail" data-tippy-content="Tooltip">Adrian B.</a></span>
        </div>

标签: javascripthtmlcss

解决方案


将tippy工具调用移至加载后

例如

$(function(){ 
  $("#footer").load("footer.html",function() { tippy('#footer') }); 
});

推荐阅读