简体   繁体   中英

How do I make my javascript embed code responsive?

I have an embed code from ShootProof with dimensions input that I want to make width responsive. I tried to change the width to 100% and it gives a blank page.

I'm sure this is simple, but any help is appreciated!

<script type="text/javascript">
  var _spRemote={width:960,height:650};var _ce = parseInt(Math.random() * 99999999);
  document.write('<sc' + 'ript type="text/javascript" src="https://proofs.carlasphotos.com/remote/embed?ce=' + _ce + '"></sc' + 'ript>');
</script>

The embed script you provided is just placing an iframe into the body of your document, you can control the width of the iframe with CSS. Because the iframe is being injected with inline styling, you will have to use !important to override the width:

iframe { width:100%!important; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM