跟著洧杰老師的腳步終於來到第七週了,這週課程也相對歡樂,相較於 RWD Bootstrap Gulp 是簡單多的 CSS 動畫效果,在 AOS 視差滾動效果裡 background-attachment: fixed 這個語法非常重要,主要是固定背景的方式,來達到視覺滾動的效果,這次的作業練習也有使用到這個語法,另外,第一周到第七週作業完成度也達到70%了,目前對於自己的行動力感到相當滿意,但是對於未來轉職之路還是很迷惘
今天也在slack上詢問了穎旻助教目前前端職缺的看法,覺得稍微有解惑,也相信自己一步一腳印,一定可以達成的!最後一週,準備衝刺囉,六角學院提供了好多獎品啊,一定要拿到!這就六角學院是跟一般仿間補習班不同的差別,六角學院就是這麼有溫度呀!
background-attachment: fixed;
background-attachment: scroll;
background-attachment: fixed;
background-attachment: local;
參考來源 MDN background-attachment
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
Basic usage
<h1 class="animate__animated animate__bounce">An animated element</h1>
transform是觸發GPU加速
Q:哪些語法,會在網頁上佔據空間 1.opacity 2.transform 3.display:none 4.visibility: hidden;
A:124
Q:哪些語法,不會在網頁上佔據空間 1.opacity 2.transform 3.display:none 4.visibility: hidden;
A:3
在 前加上以下程式碼
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<script>
AOS.init();
</script>
AOS 單一設計
<div
data-aos="fade-up"
data-aos-offset="200"
data-aos-delay="50"
data-aos-duration="1000"
data-aos-easing="ease-in-out"
data-aos-mirror="true"
data-aos-once="false"
data-aos-anchor-placement="top-center">
</div>
AOS 全域設計
AOS.init({
// Global settings:
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
startEvent: 'DOMContentLoaded', // name of the event dispatched on the document, that AOS should initialize on
initClassName: 'aos-init', // class applied after initialization
animatedClassName: 'aos-animate', // class applied on animation
useClassNames: false, // if true, will add content of `data-aos` as classes on scroll
disableMutationObserver: false, // disables automatic mutations' detections (advanced)
debounceDelay: 50, // the delay on debounce used while resizing window (advanced)
throttleDelay: 99, // the delay on throttle used while scrolling the page (advanced)
// Settings that can be overridden on per-element basis, by `data-aos-*` attributes:
offset: 120, // offset (in px) from the original trigger point
delay: 0, // values from 0 to 3000, with step 50ms
duration: 400, // values from 0 to 3000, with step 50ms
easing: 'ease', // default easing for AOS animations
once: false, // whether animation should happen only once - while scrolling down
mirror: false, // whether elements should animate out while scrolling past them
anchorPlacement: 'top-bottom', // defines which position of the element regarding to window should trigger the animation
});
once: false, 效果出現就停留 delay: 0, 滾輪滑過去幾秒會出現 offset: 120,滿足大於120px才會出現
作業等級表 Lv2:挑選第一週做的網站,來套用 JS 視差滾動
Github Pages https://viccjiang.github.io/weblayout_1127_hw07/
Github source code https://github.com/viccjiang/weblayout_1127_hw07