Chrome not rendering SVG referenced via

后端 未结 21 1618
孤独总比滥情好
孤独总比滥情好 2020-11-29 02:35

I am having issues with google chrome not rendering svg with an img tag. This happens when refreshing the page and initial page load. I can get the image to show up by \"

21条回答
  •  自闭症患者
    2020-11-29 03:22

    looks like a Chrome bug, i did something else as i almost got crazy because of this... using Chrom debugger if you change the css of the svg object it shows on the screen.

    so what i did was: 1. check for screen size 2. listen to the "load" event of my SVG object 3. when the element is loaded i change its css using jQuery 4. it did the trick for me

    if (jQuery(window).width() < 769) {
    
      jQuery('object#mysvg-logo')[0].addEventListener('load', function() {
           jQuery("object#mysvg-logo").css('width','181px');
      }, true);
    
    }
    width: 180px;
    
    

提交回复
热议问题