jsmmth / vue-loop Goto Github PK
View Code? Open in Web Editor NEWInfinite content loop for Vue
Infinite content loop for Vue
Feedback from Brian Gaden
I'll let you handle this @JosephSmith127 ๐
I have an ultrawide 21:9 monitor (43:18 technically), and when scrolling through the horizontal demo it visibly snaps the red div back to the left when about 1/3rd of the pink div is still visible.
Display resolution: 3440x1440
Chrome version 58.0.3029.96 (64-bit)
Windows 10 64-bit
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0
No errors in the console
Sorry if I am being stupid here, but I want to load dynamic data from the server on a scroll. How can I call it?
Using the exact example code, a strange issue is appearing in Chrome. When scrolling to the bottom of the page, after reaching the "Vue Loop" white page, an additional item ("1") is added. This causes an undesirable effect of reaching the "Vue Loop" page, followed by "1" and then "Vue Loop" again as the scroll bar jumps to the top.
<div class="loop-container full">
<div class="item" style="background: white;"><h1>Vue Loop</h1>
<p>Go for a scroll to try.</p></div>
<div class="item">
1
</div>
<div class="item">
2
</div>
<div class="item">
3
</div>
<div class="item">
4
</div>
<div class="item" style="background: white;"><h1>Vue Loop</h1>
<p>Go for a scroll to try.</p>
</div>
<!-- This item is added additionally. -->
<div class="item">
1
</div>
</div>
Playing around with the Vue Loop code a little, I managed to "fix" the issue by removing the +1
here:
makeDuplicates() {
...
for(var i = 0; i < division + 1; i++) {
container.appendChild(container.childNodes[i].cloneNode(true));
}
...
I doubt this is the correct way to resolve this issue. I have not been able to spend a lot of time investing the Vue Loop code logic further, but it seems that it only exists in the Vue-Loop code, and not the original pure JS code.
Am I the only one experiencing this issue?
Hoping for some help if possible! After following readme.md instructions, I'm receiving the following error via terminal:
ERROR in ./node_modules/vue-loop/VueLoop.vue
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
<template>
<div class="loop-container" :class="{'full': full, 'horizontal': horizontal}">
<slot></slot>
@ ./src/js/components/Parallax.js 15:15-34
@ ./src/js/components ^\.\/.*$
@ ./src/js/index.js
Here is my webpack.config:
var webpack = require("webpack");
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
module.exports = {
entry: {
"app": "./src/js/index.js",
"app.min": "./src/js/index.js"
},
output: {
path: __dirname + "/dist/js",
filename: "[name].js"
},
resolve: {
alias: {
"assets": path.resolve(__dirname, "assets")
}
},
plugins: [
// js
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
}),
// css
new ExtractTextPlugin({
filename: "../css/[name].css"
}),
// browserSync
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
proxy: 'grub/',
}),
],
module: {
rules: [
// js
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: {
presets: ["babel-preset-env"],
plugins: ["babel-plugin-transform-class-properties"]
}
},
},
// scss
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [
{
loader: "css-loader",
options: {
minimize: true,
discardComments: {
removeAll: true
}
}
}, {
loader: "postcss-loader",
options: {
plugins: function() {
return [
require("postcss-import"),
require("autoprefixer")
];
}
}
}, {
loader: "sass-loader"
}
]
})
},
// images
{
test: /\.(jpg|jpeg|gif|png|svg)$/,
use: {
loader: "url-loader"
}
},
// fonts
{
test: /\.(ttf|eot|woff|woff2)$/,
use: {
loader: "url-loader"
}
}
]
},
watch: true
}
and package.json:
"dependencies": {
"babel-plugin-transform-class-properties": "^6.24.1",
"basicscroll": "^1.2.0",
"blazy": "^1.8.2",
"jquery": "3.2.1",
"jquery-ui": "^1.12.1",
"node-sass": "^4.7.2",
"skrollr": "^0.6.26",
"url-loader": "^0.6.2",
"vue": "^2.5.13",
"vue-loader": "^13.0.0",
"vue-loop": "^0.2.6"
}
}
Much appriciated!
If I open the devtools on the horizontal demo page, it no longer loops around even after I close the devtools.
I'm guessing it doesn't know how to deal with changing window resolutions.
It's worth noting that I have an ultrawide monitor with a 21:9 aspect ratio, so that might be part of the issue.
Display resolution: 3440x1440
Chrome version 58.0.3029.96 (64-bit)
Windows 10 64-bit
Hey guys :)
IMHO, you should follow airbnb coding standard when it comes to write JS. It'll improve readability.
โค๏ธ
Hello!
Thanks for this, is brilliant โ I recently tried to integrate in a nuxt.js app but am unsure how to do so. Have you done so?
Thanks,
You should use addEventListener
for the resize event as it supports an infinite amount of listeners. The problem with onresize
is that it's the inline technique and only supports one handler, which makes it easily overwritable since window
is global ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.