Comments (4)
You should use the placeload when you need to make a call to get the content, and remove when the call ends. You can use the .remove()
to remove the loader.
See if it will help you:
const userLoader = Placeload
.$('.user-placeload')
.config({speed: '2s'})
.line((element) => element.width(300).height(200))
.config({spaceBetween: '30px'})
.line((element) => element.width(400).height(20))
.config({spaceBetween: '30px'})
.line((element) => element.width(400).height(20))
.config({spaceBetween: '30px'})
.line((element) => element.width(250).height(20))
userLoader.fold(
(err) => console.log('error: ', err),
(allElements) => console.log('allElements: ', allElements)
)
API.getUsers()
.then(users => {
userLoader.remove() //<--- HERE YOU ARE REMOVING THE LOAD
}
)
from placeload.js.
Thank you! Can you explain me this part of the code, please!
API.getUsers() .then(users => { userLoader.remove() //<--- HERE YOU ARE REMOVING THE LOAD } )
I'm not sure about getUsers() part of the code. Did I need to replace It with something else?
from placeload.js.
This code from the example works
<script>
--
| const user = Placeload
| .$('.user-placeload')
| .config({speed: '2s'})
| .line((element) => element.width(300).height(200))
| .config({spaceBetween: '10px'})
| .line((element) => element.width(100).height(20))
| .config({spaceBetween: '10px', right: true})
| .line((element) => element.width(50).height(20))
| .fold(
| (err) => console.log('error: ', err),
| (allElements) => console.log('allElements: ', allElements)
| )
| // simulation API
| setTimeout(() => {
| user.remove()
| }, 2000)
| </script>
Now the only problem is that the placeload is above the content and didn't mask it when load. Even in the example index.html this is the same.
In vanillajs example content is masked with css, I want the same thing but without the toggle - just placeload with hidden content when preloading and after that content to be visible.
from placeload.js.
I do not know if I understand your problem, but it seems that you want the placeload to know when its content is loaded, it disappears automatically, but it can not identify it, so you need to use the .remove
property, so it can be removed. So it's good for SPA, because they use AJAX calls to load their content, if you is not using AJAX, the placeload will not be good for you :/
from placeload.js.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from placeload.js.