他们是如何创建新的Foxy Bingo网站的

How have they made new Foxy Bingo site

本文关键字:Foxy Bingo 网站 创建 何创建 他们是      更新时间:2023-09-26

Foxy Bingo刚刚推出了一个新网站www.foxybingo.com,它充当了一个寻呼机,这意味着你点击主菜单项,它会向下滚动页面。

然而,当你点击一个链接时,URL会改变,而不是正常的#锚,而是bingo.html。

有趣的是,如果我访问www.foxybingo.com/bingo.html,它将在加载时向下滚动到页面的正确部分,但显示不同的元标题。

编辑:

如何像foxy那样将多个HTML文件导入一个页面?

该网站不包括多个页面,但使用历史api pushstate来更改带有文件名的url,如(使用jQuery代码):

var $win = $(window);
$('a#bar').click(function() {
    anim_jump($('#bar'));
    history.pushState(null, "page 2", "bar.html");
});
window.onpopstate = function(event) {
  var file = document.location.replace(/.*'//, '');
  $('html, body').prop('scrollTop', $('#' + file.replace(/.html$/)).offset().top);
};
function anim_jump(item) {
    $('html, body').animate({
        scrollTop: item.offset().top
    }, 2000);
}