Skip to content

Commit

Permalink
edit demo, default transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Jul 12, 2023
1 parent 8ebdc6f commit 5a15250
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion demo/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ useFixedHeader(headerRef, {
width: 1280px;
max-width: 100%;
height: 80px;
margin: 2rem;
margin: 1rem;
padding: 1rem;
display: flex;
align-items: center;
Expand Down
31 changes: 18 additions & 13 deletions demo/WithContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ useFixedHeader(headerRef, {
<template>
<div class="Scroll_Container" ref="containerRef">
<div class="Container">
<header class="Header" ref="headerRef">
<h2 class="Global_Logo">Vufh</h2>
<header class="Header_Wrapper" ref="headerRef">
<div class="Header_Container">
<h2 class="Global_Logo">Vufh</h2>

<a
target="_blank"
class="Header_Button"
href="https://github.com/smastrom/vue-use-fixed-header/blob/main/demo/Container.vue"
>
View Code
</a>
<a
target="_blank"
class="Header_Button"
href="https://github.com/smastrom/vue-use-fixed-header/blob/main/demo/Container.vue"
>
View Code
</a>
</div>
</header>
</div>
</div>
Expand All @@ -50,12 +52,15 @@ useFixedHeader(headerRef, {
background-color: var(--WhiteColor);
}
.Header {
justify-content: space-between;
.Header_Wrapper {
padding: 1rem;
position: sticky;
top: 1rem;
top: 0;
}
.Header_Container {
justify-content: space-between;
background-color: var(--AccentColor);
margin: 1rem;
display: flex;
align-items: center;
padding: 1rem;
Expand Down
4 changes: 1 addition & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ export const defaultOptions: UseFixedHeaderOptions = {
enterStyles: {
transition: `transform 0.3s ${easing} 0s`,
transform: 'translateY(0px)',
opacity: 1,
},
leaveStyles: {
transition: `transform 0.6s ${easing} 0s, opacity 0.6s ${easing} 0s`,
transition: `transform 0.5s ${easing} 0s`,
transform: 'translateY(-100%)',
opacity: 0,
},
}

0 comments on commit 5a15250

Please sign in to comment.