2
0
mirror of https://github.com/offen/website.git synced 2024-11-22 17:10:29 +01:00

Merge pull request #163 from offen/vueify

replace jquery with vue
This commit is contained in:
Frederik Ring 2021-05-13 10:29:26 +02:00 committed by GitHub
commit 59628cc20a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 36 deletions

View File

@ -698,6 +698,12 @@ nav ul li ul li a {
@media only screen and (max-width: 60rem) { @media only screen and (max-width: 60rem) {
.nav-list { .nav-list {
margin: 0; margin: 0;
height: 0;
overflow: hidden;
transition: all .6s;
}
.nav-list.active {
height: 280px;
} }
.nav-mobile { .nav-mobile {
display: block; display: block;
@ -707,9 +713,6 @@ nav ul li ul li a {
padding: 0; padding: 0;
padding-top: 4rem; padding-top: 4rem;
} }
nav ul {
display: none;
}
nav ul li { nav ul li {
float: none; float: none;
} }

View File

@ -1,10 +1,13 @@
;(function ($) { new window.Vue({ // eslint-disable-line no-new
$(document).ready(function () { el: 'body.index .icon',
$(window).scroll(function () { data: {
if ($(window).width() > 480) { progress: 0
var scrollProgress = parseInt($(window).scrollTop(), 10) },
$('body.index .icon').css('opacity', Math.min(scrollProgress / 100, 1)) mounted: function () {
var self = this
window.addEventListener('scroll', function () {
var scrollTop = parseInt(window.document.documentElement.scrollTop, 10)
self.progress = Math.min(scrollTop / 100, 1)
})
} }
}) })
})
})(window.jQuery)

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,11 @@
;(function ($) { new window.Vue({ // eslint-disable-line no-new
$(function () { el: '#navigation',
$('nav ul li a:not(:only-child)').click(function (e) { data: {
$(this).siblings('.nav-dropdown').toggle() active: false
$('.dropdown').not($(this).siblings()).hide() },
e.stopPropagation() methods: {
}) toggle: function () {
$('html').click(function () { this.active = !this.active
$('.nav-dropdown').hide() }
}) }
$('#nav-toggle').click(function () { })
$(this).closest('nav').find('ul').slideToggle()
$(this).toggleClass('active')
})
})
})(window.jQuery)

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
</title> </title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' *.offen.dev; frame-src 'self' *.offen.dev; style-src 'self' 'unsafe-inline'"> <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-eval' *.offen.dev; frame-src 'self' *.offen.dev; style-src 'self' 'unsafe-inline'">
<meta name="referrer" content="origin"> <meta name="referrer" content="origin">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
@ -41,16 +41,20 @@
<div class="menu w-100 cclr-bg-yellow-mid"> <div class="menu w-100 cclr-bg-yellow-mid">
<section class="nav-bar"> <section class="nav-bar">
<div class="nav-container"> <div class="nav-container">
<div class="icon flex"> <div class="icon flex" v-bind:style="{ opacity: progress }">
<a class="link dim" href="/"><img src="/theme/images/offen-icon-white.svg" alt="Offen logo" width="37" height="40" class="logo"></a> <a class="link dim" href="/"><img src="/theme/images/offen-icon-white.svg" alt="Offen logo" width="37" height="40" class="logo"></a>
<header> <header>
<a class="link dim" href="/"><p class="fLogo normal ma0 ml2 white">Offen</p></a> <a class="link dim" href="/"><p class="fLogo normal ma0 ml2 white">Offen</p></a>
</header> </header>
</div> </div>
{% if not funnel %} {% if not funnel %}
<nav> <nav id="navigation">
<div class="nav-mobile"><span id="nav-toggle"><span></span></span></div> <div class="nav-mobile">
<ul class="nav-list"> <span id="nav-toggle" v-on:click="toggle" v-bind:class="{ active: active }">
<span></span>
</span>
</div>
<ul class="nav-list" v-bind:class="{ active: active }">
{% if not index %} {% if not index %}
<li> <li>
<a class="b link dim cclr-fnt-black-mid" href="/">Summary</a> <a class="b link dim cclr-fnt-black-mid" href="/">Summary</a>
@ -323,7 +327,7 @@
</footer> </footer>
</div> </div>
{% block scripts %} {% block scripts %}
{% assets filters="rjsmin", output="scripts/packed.js", "scripts/jquery-3.4.1.min.js", "scripts/menu.js", "scripts/fade.js" %} {% assets filters="rjsmin", output="scripts/packed.js", "scripts/vue.min.js", "scripts/menu.js", "scripts/fade.js" %}
<script src="/{{ ASSET_URL }}"></script> <script src="/{{ ASSET_URL }}"></script>
{% endassets %} {% endassets %}
{% endblock %} {% endblock %}