Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commita142caf76fa5cb13da81822e008c1a7357d5f762 (patch)
Author
 Yan Zhu <picturepan2@hotmail.com>
2017-03-03 19:22:09 +0800
Committer
 Yan Zhu <picturepan2@hotmail.com>
2017-03-03 19:22:09 +0800
Files711813d282c0b428ca00f71848364056c30c35a7 /src
Spectre-Dark-Gruvbox-a142caf76fa5cb13da81822e008c1a7357d5f762.tar
Spectre-Dark-Gruvbox-a142caf76fa5cb13da81822e008c1a7357d5f762.tar.gz
Spectre-Dark-Gruvbox-a142caf76fa5cb13da81822e008c1a7357d5f762.zip
Parent5a9b45d27f0b3e950709ca921c7f962b388d1c5f (diff)
Add pure CSS Parallax effect (exp)
2 files changed, 93 insertions, 1 deletions
-rw-r--r--src/navs.less2
-rw-r--r--src/parallax.less92
diff --git a/src/navs.less b/src/navs.less
index f022fcc..160d028 100644
--- a/src/navs.less
+++ b/src/navs.less
@@ -15,7 +15,7 @@
}
&.active {
& > a {
- color: @body-font-color;
+ color: @dark-gray-color;
font-weight: bold;
&:focus,
&:hover {
diff --git a/src/parallax.less b/src/parallax.less
new file mode 100644
index 0000000..15f9f5e
--- /dev/null
+++ b/src/parallax.less
@@ -0,0 +1,92 @@
+// Parallax
+@parallax-deg: 3deg;
+
+.parallax {
+ display: block;
+ height: auto;
+ position: relative;
+ width: auto;
+
+ .parallax-content {
+ box-shadow: 0 2.5rem 5rem rgba(0, 0, 0, .45);
+ height: auto;
+ transform: perspective(600px);
+ transform-style: preserve-3d;
+ transition: all .4s ease;
+ width: 100%;
+
+ &::before {
+ content: "";
+ display: block;
+ height: 100%;
+ left: 0;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ }
+ }
+
+ .parallax-top-left {
+ .parallax-dir();
+ left: 0;
+ top: 0;
+
+ &:hover ~ .parallax-content {
+ transform: perspective(600px) rotateX(@parallax-deg) rotateY(-@parallax-deg);
+
+ &::before {
+ background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 50%);
+ }
+ }
+ }
+
+ .parallax-top-right {
+ .parallax-dir();
+ right: 0;
+ top: 0;
+
+ &:hover ~ .parallax-content {
+ transform: perspective(600px) rotateX(@parallax-deg) rotateY(@parallax-deg);
+
+ &::before {
+ background: linear-gradient(-135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 50%);
+ }
+ }
+ }
+
+ .parallax-bottom-left {
+ .parallax-dir();
+ bottom: 0;
+ left: 0;
+
+ &:hover ~ .parallax-content {
+ transform: perspective(600px) rotateX(-@parallax-deg) rotateY(-@parallax-deg);
+
+ &::before {
+ background: linear-gradient(45deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 50%);
+ }
+ }
+ }
+
+ .parallax-bottom-right {
+ .parallax-dir();
+ bottom: 0;
+ right: 0;
+
+ &:hover ~ .parallax-content {
+ transform: perspective(600px) rotateX(-@parallax-deg) rotateY(@parallax-deg);
+
+ &::before {
+ background: linear-gradient(-45deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 50%);
+ }
+ }
+ }
+}
+
+.parallax-dir() {
+ //background: rgba(0,0,0,.15);
+ height: 50%;
+ position: absolute;
+ width: 50%;
+ z-index: 99;
+}