このページのトップへ
Sticky Header

Sticky Header

Keep the site header visible when a visitor scrolls the page.

中級.png

初心者

19K

出版された:

2020年1月1日

酒を楽しむ少女

によって

アンカー 1
開発者を雇う

説明例

In this example site header is kept visible when a visitor scrolls the page.

コード例

タブ1

.

タブ2

.

タブ3

.

このコードによる解決は複雑になる可能性がある。

どのように構築したか

This example demonstrates how to use events to freeze your header and change its appearance as users scroll through your site.

 

To create a sticky header, we will use two Classic Strip elements—one with a transparent background and the other with a white background. Customize the transparent Strip, adding header elements like your name, logo and a Menu. Once this Strip is designed, duplicate it and change its background color to white. Drag and drop each Strip and Attach to Header.


First, we made the white header hidden on load and added an anchor, which we'll use as a trigger point for the switch and add to it two event handlers—onViewportLeave and onViewportEnter—to change the header background as users scroll through the site.

 

You can put this either in your page code to make the change in one place, or in the site code to make it in all pages.


次のステップ


  1. この例をエディターで開き、テンプレートを操作してください。

  2. サイトを公開する。

  3. どのように Veloでの例題の扱い方.

使用したAPI

コード以外の例。

コード以外の例。

関連記事

記事リンク

開発者を雇う

Veloソリューションは強力なツールですが、自力で構築するのは困難です。経験豊富なVelo開発会社に構築をお任せください。

関連例

これは役に立ったか?

はい

|

いいえ

ご意見ありがとう!

エレメントの非表示と表示

エレメントの非表示と表示

ユーザーのインタラクションに応じて要素を隠したり表示したりする。

中級.png

中級

Hide and Show an Image

Hide and Show an Image

Show and hide an image according to the clicked button.

中級.png

初心者

崩壊要素

崩壊要素

要素グループの折りたたみと展開。

中級.png

初心者

サイト・コンテンツの変更

サイト・コンテンツの変更

ユーザーのインタラクションに応じてサイトのコンテンツを変更する。

中級.png

初心者

アンカー2
ページ下