Giter Club home page Giter Club logo

Comments (4)

xdiscovery avatar xdiscovery commented on August 15, 2024

I also tried to work out with this solution but didn't help for me yet...
(http://stackoverflow.com/a/5933319/305883)

function FULL_IMAGE(fimage) {
var loaded = false;
function loadHandler() {
if (loaded) {
return;
}
loaded = true;
}
var img = new Image();
img.onload = loadHandler;
img.src = fimage;
img.style.display = 'block';
if (img.complete) {
loadHandler();
return (img.width, img.height);
}
}

from vivagraphjs.

anvaka avatar anvaka commented on August 15, 2024

Here is a demo: http://jsfiddle.net/anvaka/nK75s/
It loads detached DOM image and only then sets the link to svg image.

I'm not sure why Google Chrome does not fire load event as described here for SVG images. Firefox does fire it.

Anyways solution with plain DOM images worked in both browsers. I wouldn't worry too much about loading the same image twice - browsers normally will not make additional request for the same resource, and reuse what they have. In the JS Fiddle above Chrome indeed does only one request for each image.

from vivagraphjs.

gg4u avatar gg4u commented on August 15, 2024

thank you man!
I've just seen your answer only now!

from vivagraphjs.

anvaka avatar anvaka commented on August 15, 2024

Glad it worked :)

from vivagraphjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.