A simple solution for the adaptability of advertising banners on the site.
- CDN jquery 3.21
- CDN bootstrap
[not necessary]
Now the script finds all <iframe>...</iframe>
on the page and counts them relative to the parent element <div>
No additional connection is required on the page. We can see an example of usage in the file index.html
- connect jquery
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- connect
fluid_frame_ad.js
file<script src="/js/fluid_frame_ad.js"></script>
usage example:
<div>
<iframe src="{YOUR_LINK}"></iframe>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="/js/fluid_frame_ad.js"></script>
Note
the specified <div>
block should be used to frame your <iframe>
so that the code counts the width from the parent element
๐คทโโ๏ธ perhaps in the future I will expand support for banner types and make the code better
โ the code has been updated and the method of its connection, including