How to detect map container resize due to slow loading image? - vue.js

I am creating an app with a Leaflet map in Nuxt using Vue2Leaflet plugin.
I am having a problem though: I am using Bootstrap columns to size the map and accompanying image, but the image loads too slow (this cannot be resolved at this time), so the container is not the proper size when the map loads.
This causes the map to be half grey. I have attempted to call map.invalidateSize() in the mounted event, but even that must be happening before the image finishes loading.
I have setup a sandbox at: https://codesandbox.io/s/eager-bohr-c3453?file=/src/App.vue
In order to see the bug, you have to view the rendered app at https://c3453.csb.app/ (the internal codesandbox render does not show the problem)
I think I need some way to wait until the image has completed loading (so the BS col is the proper size), then call map.invalidateSize(), but I am not sure how...

You can attach an onload listener on your <img>, so that you can call (again?) your Leaflet map invalidateSize() method.

Related

jqueryLazy not triggering when images gets visibles via css changes

I have a bunch of images, say 100 images, in a web page, and only 10 are visible without scrolling the page. The first 90 images have a "myclass" class.
I manage all images with jquery lazy (http://jquery.eisbehr.de/lazy/), and it works perfecty if I scroll the window.
However, If I make $(".myclass").hide() before scrolling down, I see the last 10 images, which don't have the "myclass" class, bug jquery lazy doesn't "reveal" them.
Why?
Because lazyload triggers on scroll events.
$(window).scroll() (which triggers the scroll event on the window) is enough to solve the issue.
If the scrollable div is not the window object, use it instead of $(window).

Wait till API response before changing view with Vue Router

Working on a car dealership site and playing with vue router.
The issue currently is that I have a homepage with a grid of vehicle, when clicking to view one on its own page I have to wait for the random parts to load in ,which causes page height jumps etc.
Is there a way I can trigger the view to load a method but only change the route and view when I say to (api has returned a response)?
On YouTube for example, you click a link and get the progress bar before the view changes.
Thanks.
The issue with your page height jump could be resolved by this.
As for pre-loading the data, you can use the beforeRouteEnter() function, here.

Hide image while loading new source

I've implemented a React Native component which shows an image loaded from a remote server. The user can swipe the image out of the screen in order to navigate to the next image which is again loaded from the remote server. While loading of the second image, the old image is still visible on the screen.
I want the old image to disappear while loading the next image. Any hint how to achieve this?
Prop defaultSource only works for initial render (showing the first image) but not consecutive images. So I guess React reuses the Image under the hood. I've played around with onLoadStart and onLoadEnd but I don't know how to reset the source of the old image.
Any idea?
Thanks.
Add a unique key prop to each image. It can be a number or a string. That will prevent React from re-using the elements.

iScroll5 Infinite scrolling - lazy loading

A am developing a list based app, wherein I am tryin to use iScroll5 to implement lot of animations and smooth scrolling functions. I would like to do lazy loading of my contents wherein I want to load first 50 list elements to DOM and based on user scroll event asynchronously bind the next set of list elements to the DOM.
Am I on the right track to go with the iScroll5 - Infinite scrolling API or is there any other library which does the job for me ?
If you want to use infinite scrolling , means on page load some content are pre load and then user scroll down and other content are load on scroll with lazy loging, if i am understan right then please try to use jscroll jquery plugin.. it's very good for infinite scroll.
http://jscroll.com/ you can find here document and example of this plugin.
Regards,
vinit

QML Loader strange behavior

I'm having issues rendering using OpenGL with a QQuickItem.
The setup:
I've partitioned the app window into a status bar and a display area. The display area will be used to render output from various Qt plugins. I'm using the QML Loader object to dynamically load the objects from the plugins as needed.
The problem:
I've duplicated the opengl rendering with qml example. If I load it into the display area directly it works perfectly. If I load it into the display area using a Loader it displays nothing. I've logged debugging messages and it's definitely running. I've debugged the app using GDebugger and it appears to be sending OpenGL calls.
Does the loader object mess with the window context?
Any suggestions on how to get this to work?
Is source for the loader object available somewhere?
The problem was not that the custom control wasn't drawing. It was my misuse of QML.
The dynamic loader was adding the content to a 'column' control. The layout controls exhibit 'undefined behavior' if you use them incorrectly. Changing to manual layout using anchors corrected the issue.