Skip to content

Instantly share code, notes, and snippets.

<template>
<div class="home" transition="slideHome">
<h1>{{ msg }}</h1>
<div id="work">
<article class="project-item" v-for="project in projects">
<a v-link="project.url">
<div class="project-item__inner">
<h1 class="project-item__title">{{ project.title }}</h1>
<div class="project-item__thumb" v-bind:style=""></div>
</div>
<template>
<div class="single" transition="slideSingle">
<h1>{{ title }}</h1>
</div>
</template>
<script>
import Vue from 'vue'
import './css/reset/normalize.scss'
import './css/base/base.scss'
import Vue from 'vue'
import VueRouter from 'vue-router'
import About from './about.vue'
import Home from './home.vue'
import Single from './single.vue'
Vue.use(VueRouter);
this.current == (this.total - 1) ? (this.current = 0 && this.prev = (this.total - 1)) : (this.current += 1 && this.prev = (this.current - 1))
if(this.current == (this.total - 1)) {
this.current = 0
this.prev = (this.total - 1)
} else {
this.current += 1
this.prev = (this.current - 1)
}
@jesperlandberg
jesperlandberg / nuxt.config.js
Last active October 24, 2017 07:05
nuxt.config.js
const axios = require('axios')
module.exports = {
generate: {
routes: function () {
return axios.get('http://exmaple.com/api/cases')
.then((res) => {
return res.data.objects.map((content) => {
return {
route: '/case/' + content.slug,
@jesperlandberg
jesperlandberg / dynamic-route.vue
Created October 24, 2017 07:04
Dynamic route
export default {
async asyncData ({ params, error, payload }) {
if (payload) return { content: payload }
else return {
content: 'something else'
}
}
}
import Scrollbar, { ScrollbarPlugin } from 'smooth-scrollbar'
class InvertDeltaPlugin extends ScrollbarPlugin {
static pluginName = 'invertDelta'
static defaultOptions = {
events: [],
}
transformDelta(delta, fromEvent) {
import TweenMax from 'gsap'
import event from 'dom-events'
import lerp from '~/assets/js/functions/lerp'
export default class Smooth {
constructor() {
this.createBound()
this.content = document.querySelector('.js-scroll-content')
this.sections = [...this.content.querySelectorAll('.js-scroll-section')]
import TweenMax from 'gsap'
import event from 'dom-events'
import lerp from '~/assets/js/functions/lerp'
export default class Smooth {
constructor() {
this.createBound()
this.content = document.querySelector('.js-scroll-content')
this.sections = [...this.content.querySelectorAll('.js-scroll-section')]
@jesperlandberg
jesperlandberg / magnetic.js
Created February 20, 2018 19:41
magnetic
import TweenMax from 'gsap'
import events from 'dom-events'
export default class Magnetic {
constructor() {
this.elem = document.querySelector('[data-magnetic]')
this.cursor = {
x: 0,
y: 0