logo
down
shadow

How to fit iframe content size to its div area in bootstrap 4 when the window is shrunk?


How to fit iframe content size to its div area in bootstrap 4 when the window is shrunk?

Content Index :

How to fit iframe content size to its div area in bootstrap 4 when the window is shrunk?
Tag : jquery , By : 40a
Date : January 11 2021, 05:14 PM

I hope this helps . I think the parent div of the iframe that is
has less width for small views as you have given it class col-5. It will take 5 columns for all device sizes. If you want your iframe to be bigger for small devices you can change the parent div class from col-5 to col-lg-5 so that it takes 5 columns only in large devices and 12 columns (100% width) for small devices.
<div class="col-5 mx-auto"> // before, change this as below

<div class="col-lg-5 mx-auto"> // After
/* Under line of section title */
.heading-underline{
   width: 3rem;
   height: .2rem;
   background-color: #1EBBAE;
   margin:0 auto 2rem; /*format: top left&right bottom*/
}
/* End under line of section title */
h3.heading{
   font-size: 1.9rem;
   font-weight: 700;
   text-transform: uppercase;
   margin-bottom: 1.9rem;
}
/*--- Bootstrap Mobile Gutter Fix --*/
.row, .container-fluid {
   margin-left: 0px!important;
   margin-right: 0px!important;
}

/*--- iOS Fixed Background Image --*/
.fixed-background {
   position: relative;
   width: 100%;
}
.fixed-wrap {
   clip: rect(0, auto, auto, 0);
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   z-index: -999!important;
}
.fixed {
   position: fixed;
   display: block;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-size: cover;
   background-position: center center;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}


/*--------------------- Resources Section---------------------------*/
.fixed{
   background-image: url(../images/2018-Jeep-Wrangler-front-02.jpg);
   z-index: -1;/*makes background running in backside, while "1" makes it will be shown in front side*/ 
}  
.dark{
   background-color: rgba(0, 0, 0, 0.75);
   color: white;
   padding: 7rem 2rem;/*format: top&bottom left&right.*/
}
.fixed-background h3{
   margin-bottom: 2rem;/*2rem*/
}
.fixed-background p{
   margin-top: 1.5rem;
}
.resource svg.svg-inline--fa{ /* svg.inline--fa is found from google chrome inspector*/
   color : #1EBBAE;
}
.resource h3{
   font-size: 1.3rem;
   text-transform: uppercase;
   padding-bottom: .4rem;
}
.resource p{
   font-size: 1.1rem;
   text-align: justify;
   text-justify:auto;
   word-wrap: break-word;
   width: 400px;
}
.resource img{
   width: 60%;
   height: 55%;
   opacity: 0.3;
   filter: alpha(opacity=30); /* For IE8 and earlier */
}
.resource img:hover{
   opacity: 1;
   filter: alpha(opacity=100); /* For IE8 and earlier */
}

/*white border*/
.boxshadow{
   position: relative;
  -moz-box-shadow: 1px 2px 4px rgba(0, 0, 0,0.5);
  -webkit-box-shadow: 1px 2px 4px rgba(0, 0, 0, .5);
  box-shadow: 1px 2px 4px rgba(0, 0, 0, .5);
  padding: 10px;
  background: white;
}
.boxshadow:hover{
   position: relative;
   -moz-box-shadow: 1px 2px 4px rgba(0, 0, 0,0.5);
   -webkit-box-shadow: 1px 2px 4px rgba(0, 0, 0, .5);
   box-shadow: 1px 2px 4px rgba(0, 0, 0, .5);
   padding: 10px;
   background: #1EBBAE;
}
/*end white border*/

/* Make the image fit the box */
.boxshadow img {
   width: 100%;
   border: 1px solid #8a4419;
   border-style: inset;
}
/* end make the image fit the box*/

.boxshadow::after {
   content: '';
   position: absolute;
   z-index: -1; /* hide shadow behind image */
   -webkit-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
   -moz-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
   box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);        
   width: 70%; 
   left: 15%; /* one half of the remaining 30% */
   height: 100px;
   bottom: 0;
}

#resources h3{
   text-transform: uppercase;
}
#resources .btn-secondary{
   border-width: medium;
   border-radius: 0;
   padding: .2rem .5rem;/*.6rem 1.2rem*/
   font-size: 1rem;/*1.2rem*/
   text-transform: unset;
   margin: 1rem;
   border-color: #1EBBAE;
   background-color: #1EBBAE;
   color: white;
}

@media(max-width: 767px){
   /*iframe of video where the problem at*/
   .col-5 .resource iframe{
      width: 100%;
      height:auto;
   }
   /*end iframe where the problem at*/
}
<link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
      integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
      crossorigin="anonymous"
    />
    
<div id="resources" class="offset">

<div class="fixed-background">

   <div class="row dark text-center">

      <div class="col-12">
         <h3 class="heading">Sewa dari Tiga Kota Besar di Sumatera</h3>
            <div class="heading-underline"></div>
      </div>

      <div class="col-md-4">
          <h3>Medan</h3>
            <div class="resource">
               <img class="boxshadow" src="images/icon-medan.jpg">
            </div>
            <a class="btn btn-secondary btn-sm" href="#" target="_blank">Pesan Disini</a>
       </div>

       <div class="col-md-4">
           <h3>Palembang</h3>
           <div class="resource">
              <img class="boxshadow" src="images/icon-palembang.jpg">
           </div>
           <a class="btn btn-secondary btn-sm" href="#" target="_blank">Pesan Disini</a>
       </div>

       <div class="col-md-4">
          <h3>Padang</h3>
             <div class="resource">
                <img class="boxshadow" src="images/icon-padang.jpg">
             </div>
             <a class="btn btn-secondary btn-sm" href="#" target="_blank">Pesan Disini</a>
       </div>   

       <div class="col-lg-5 mx-auto">
          <div class="resource">
             <div class="heading-underline"></div>
                <!-- 16:9 aspect ratio, THIS IS THE SUITE ONE-->
                <div class="embed-responsive embed-responsive-16by9">
                   <!-- "..?playlist=(embedded-link)&loop=1" is for repeated the same videos that played -->
                   <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/Y-1H27WxaJo?playlist=Y-1H27WxaJo&loop=1" allowfullscreen autoplay></iframe>
                </div>
          </div>
       </div>

   </div><!-- End Row Dark -->
   <div class="fixed-wrap">
      <div class="fixed"><!-- class fixed is where we add the background image -->

      </div> 
   </div>

</div><!-- End Fixed Background -->

</div>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Large right margin when browser is shrunk to mobile size on Bootstrap


Tag : css , By : Matt Croydon
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I apologize for lack of code examples in this question but I'm not even sure what to put. If you visit this page: , Its coming from this padding:
 @media (max-width: 767px){
    body {
        padding-right: 20px;
        padding-left: 20px;
    }
 }
 @media (max-width: 767px){
    .navbar {
       padding:0 20px;
    } 
 }

Tag : html , By : Sumedh
Date : March 29 2020, 07:55 AM
it should still fix some issue Use min-height on the box, remove absolute positioning from the bottom and both div's heights will be kept.
When the margin-top: auto is set on a flex column item, it will push it to the bottom of is parent, which you can see on bigger screens.
body {
  margin: 0;
  display: flex;                  /*  IE bug fix  */
}

#box {
  flex-grow: 1;                   /*  fill body's width  */

  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

#top {
  background-color: red;
  height: 560px;
  width: 400px;
  border: 1px solid black;
}

#bottom {
  margin-top: auto;               /*  push it to the bottom on big screen  */
  background-color: green;
  height: 100px;
  width: 400px;
  border: 1px solid black;  
}
<div id="box">
  <div id="top">
  </div>
  <div id="bottom">
  </div>
</div>
html, body {
  margin: 0;
}
#box {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
}

#top {
  background-color: red;
  height: 560px;
  width: 400px;
  border: 1px solid black;
}

#bottom {
  margin-top: auto;
  flex-shrink: 0;
  background-color: green;
  height: 100px;
  width: 400px;
  border: 1px solid black;  
}
<div id="box">
  <div id="top">
  </div>
  <div id="bottom">
  </div>
</div>

Tag : html , By : RichAA
Date : March 29 2020, 07:55 AM
Hope this helps Without flexbox according to the given HTML
Set a height for footer, e.g. 50px.
main,
main aside,
main .content {
  height: calc(100vh - 100px);
}

main {
  margin-top: 50px;
}

main aside,
main .content {
  padding: 15px 0;
}

main aside {
  background: red;
}

main .content {
  overflow-y: auto;
  background: blue;
}

.footer {
  height: 50px;
  line-height: 50px;
  background: #F8F8F8;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div class="navbar navbar-fixed-top navbar-default" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
      <a class="navbar-brand" href="#">Project name</a>
    </div>
    <div class="collapse navbar-collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </div>
    <!-- /.nav-collapse -->
  </div>
  <!-- /.container -->
</div>
<!-- /.navbar -->

<main>
  <div class="container-fluid">
    <div class="row">
      <aside class="hidden-xs col-sm-3">
        <ul>
          <li>List 1</li>
          <li>List 2</li>
          <li>List 3</li>
          <li>List 4</li>
          <li>List 5</li>
        </ul>
      </aside>
      <div class="content col-sm-9">
        <div class="jumbotron">
          <a href="#" class="visible-xs" data-toggle="offcanvas"><i class="fa fa-lg fa-reorder"></i></a>
          <h1>test</h1>
          <p>This is an example to show the potential of an offcanvas layout pattern in Bootstrap. Try some responsive-range viewport sizes to see it in action.</p>
        </div>
        <div class="col-xs-12">
          <h2>Heading</h2>
          <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML,
            CSS and Javascript.</p>
          <p><a class="btn btn-default" href="#">View details »</a></p>
        </div>
        <div class="col-xs-12">
          <h2>Heading</h2>
          <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML,
            CSS and Javascript.</p>
          <p><a class="btn btn-default" href="#">View details »</a></p>
        </div>
        <div class="col-xs-12">
          <h2>Heading</h2>
          <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML,
            CSS and Javascript.</p>
          <p><a class="btn btn-default" href="#">View details »</a></p>
        </div>
        <div class="col-xs-12">
          <h2>Heading</h2>
          <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML,
            CSS and Javascript.</p>
          <p><a class="btn btn-default" href="#">View details »</a></p>
        </div>
      </div>
    </div>
  </div>
</main>

<footer class="footer">
  <div class="container-fluid">
    Footer
  </div>
</footer>

Dynamically define iframe height based on window size (NOT CONTENT)


Tag : javascript , By : enginecrew
Date : March 29 2020, 07:55 AM

Need a dynamic iframe that adjusts to content within AND is responsive to device screen/window size


Tag : javascript , By : Nandor Devai
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Unable to send data from Form to SQL database
  • If all divs have same style, remove element
  • How to click a jQuery Dialog button in TestCafe
  • Cannot reinitialise DataTable with Angular Datatable
  • How to add Class active on Click in Navbar
  • how to call fail method into jquery.get/post success method?
  • Slider with tabs
  • Jquery Get parent element from data function
  • Ho to put a new line in <p> tag in my jquery?
  • How can I use a text value as a mathematical operator?
  • DataTable columns values showing Only DefaultContent
  • JQuery select dynamically added elements
  • How to change an image source on hover?
  • How to bind jquery event to dynamically added multiple DOM elements?
  • How to get td values and store in array using Jquery?
  • How to add handler to dinamically created tr in JQuery?
  • How to Covert Html to PDF in Jquery?
  • Jquery before() and after() used to create a <div> container not inserting closing tags in after()
  • I want to delete previously added class
  • Open html page in same window after clicking on navlink
  • Datatable is not working when I populate table using smarty
  • How to change image based on the offset top of the content div
  • Find the index of table column with specific id
  • How to return value of $(window).resize()
  • How to optimize adding numerous elements dynamically into web page
  • Content slide down on top of page?
  • How to write if statement for when a specified option is selected in select tag in JQuery
  • HTML tags remove from textarea using jQuery
  • ShareThis not display properly when initially hidden
  • jquery - Bind datepicker event
  • How can I cause an element to move on mouse scroll using transform matrix?
  • How to add Custom summaries for autogenerated colums?
  • How to update table row with data from an array using jQuery
  • Cannot get the element in jQuery
  • How to search for two values in array at the same time?
  • Creating a floating document property control that is available in all tabs of Spotfire dashboard
  • Add a "wrapper" div tag to wrap other html div tags?
  • Reload form if I get an error when validate email
  • jQuery animate height in percentage scrolls to the top
  • How to add class for per string after comma?
  • ("ID").Value not working in ASP.net user control
  • HTML Color-picker with colors box
  • Initialize Kendo Grid grouped
  • jQuery click event triggers for all picture objects
  • addClass with the full match of id in jquery
  • Function is not called on click
  • jQuery ajax.error() for all errors except 403
  • Disable other option in same div, when first one is selected
  • How to clear input text
  • Rails Nested Forms Attributes not saving if Fields Added with jQuery
  • Jquery FancyBox target specific DIV ID?
  • jQuery table paging
  • Using Jquery UI Tab control in ASP.NET MVC
  • jQuery Datatable dynamic edit button attached to each row
  • JQUERY: Setting Active state on animated menu tabs
  • Filtering data with jquery
  • JQuery punctuation for spanish (ó, í, etc.) not working in IE8
  • Intro Bar like Stack Overflow
  • Jquery .filter() Question
  • ckeditor blur and dialog
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com