本文介绍了Bootstrap Carousel弹跳,无法使用HTML和CSS对其进行编辑-包含O/P gif的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误的输出:

如果您敏锐地看到轮播从杏仁2移到杏仁3时发生了这种小的跳跃,则我尝试以所有方式将其删除,但无法删除.为了显示输出,我附加了pencode链接.您可以在此处

解决方案

  body {溢出-x:隐藏;}.about_nuts {边距顶部:10像素;文本对齐:居中;font-size:25px;字体家族:"Poppins";font-weight:粗体;}.our_services_expl {文本对齐:居中;字体家族:"Poppins";}.carousel-item{边距:20px 0px;}.centering_the_slider_contents {宽度:100%;文本对齐:居中;背景:#ebebeb;显示:flex;}.images_in_nuts {边界半径:50%;宽度:250像素;高度:250像素;显示:inline-block;溢出:隐藏;}.nu​​t_text {显示:inline-block;垂直对齐:顶部;边距顶部:30像素;}//.last_contact_us {//背景:#ffffff!important;//}.footer_contact_us {边距顶部:10像素;文本对齐:居中;font-size:25px;字体家族:"Poppins";font-weight:粗体;}.footer_contact_us_expl {文本对齐:居中;字体家族:"Poppins";}  
 <链接rel ="stylesheet"href ="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"完整性="sha384-Gn5384xqQQ1aoWXA + 058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"crossorigin ="anonymous"/>< div class ="about_nuts_main" id ="section_about_nuts_main">< p class ="about_nuts">关于坚果</p>< p class ="our_services_expl">不要害羞选择您喜欢的坚果并了解< br/>里面有什么</p></div><!-关于螺母-滑块->< div id ="myCarousel" class ="carousel slide" data-ride ="carousel">< div class ="slider">< div class ="centering_the_slider_contents"><!-螺母1->< div class ="carousel-item active">< figure class ="images_in_nuts">< img src ="images/almonds.jpg"/></figure>< div class ="nut_text">< h2>杏仁</h2>< h3 class ="rich_in"&Rich In</h3>< p>维生素E,单不饱和脂肪,纤维,生物素,钙,磷,镁,铜,植物营养素,特别是类黄酮,植物固醇.酚酸</p></div></div><!-螺母1末端-><!-螺母2->< div class ="carousel-item">< figure class ="images_in_nuts">< img src ="images/almonds.jpg"/></figure>< div class ="nut_text">< h2>杏仁2</h2>< h3 class ="rich_in"&Rich In</h3>< p>维生素E,单不饱和脂肪,纤维,生物素,钙,磷,镁,铜,植物营养素,特别是类黄酮,植物固醇.酚酸</p></div></div><!-螺母2端头-><!-螺母3->< div class ="carousel-item">< figure class ="images_in_nuts">< img src ="images/almonds.jpg"/></figure>< div class ="nut_text">< h2>杏仁3</h2>< h3 class ="rich_in"&Rich In</h3>< p>维生素E,单不饱和脂肪,纤维,生物素,钙,磷,镁,铜,植物营养素,特别是类黄酮,植物固醇.酚酸</p></div></div><!-螺母3端-</div></div><脚本src ="https://code.jquery.com/jquery-3.2.1.slim.min.js"完整性="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"crossorigin ="anonymous"></script><脚本src ="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"完整性="sha384-ApNbgh9B + Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"crossorigin ="anonymous"></script><脚本src ="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"完整性="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5 + 76PVCmYl"crossorigin ="anonymous"></script></div></div></div></div><!-与螺母相关的所有内容都在这里-滑头-< div class ="last_contact_us" id ="last_contact_us">< p class ="footer_contact_us">与我们联系</p>< p class ="footer_contact_us_expl">致电我们以获取最优质的坚果和香料.并以最优惠的价格</p></div><脚本src ="https://code.jquery.com/jquery-3.2.1.slim.min.js"完整性="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"crossorigin ="anonymous"></script><脚本src ="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"完整性="sha384-ApNbgh9B + Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"crossorigin ="anonymous"></script><脚本src ="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"完整性="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5 + 76PVCmYl"crossorigin ="anonymous"></script>  

.centering_the_slider_contents 中删除padding-top,以修复跳动,并在 .carousel-item 空间上添加top + bottom底边距.

incorrect output:

If you see keenly when the carousel moves from almond 2 to almond 3 there is this small jump happens, I tried to remove in all way but I couldnt remove it. To show the output I have attached the pencode link. you can see the result here https://codepen.io/gladwin-james/pen/oNYWJxL and also uploaded the above GIF for clear expalnation. I have also shared the same code I shared in pencode

HTML

<link
          rel="stylesheet"
          href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
          crossorigin="anonymous"
        />

    <!-- About nuts - Slider-->
        <div id="myCarousel" class="carousel slide" data-ride="carousel">
          <div class="slider">
            <div class="centering_the_slider_contents">
              <!-- Nut 1-->
              <div class="carousel-item active">
                <figure class="images_in_nuts">
                  <img src="images/almonds.jpg" />
                </figure>
                <div class="nut_text">
                  <h2>Almond</h2>
                  <h3 class="rich_in">Rich In</h3>
                  <p>
                    Vitamin E, Monounsaturated fats, Fiber, Biotin, <br />Calcium,
                    Phosphorus, Magnesium, Copper, <br />
                    Phytonutrients, specifically flavonoids, plant sterols,<br />
                    phenolic acids
                  </p>
                </div>
              </div>
              <!-- Nut 1 Ends-->
              <!-- Nut 2-->
              <div class="carousel-item">
                <figure class="images_in_nuts">
                  <img src="images/almonds.jpg" />
                </figure>
                <div class="nut_text">
                  <h2>Almond 2</h2>
                  <h3 class="rich_in">Rich In</h3>
                  <p>
                    Vitamin E, Monounsaturated fats, Fiber, Biotin, <br />Calcium,
                    Phosphorus, Magnesium, Copper, <br />
                    Phytonutrients, specifically flavonoids, plant sterols,<br />
                    phenolic acids
                  </p>
                </div>
              </div>
              <!-- Nut 2 Ends-->
              <!-- Nut 3-->
              <div class="carousel-item">
                <figure class="images_in_nuts">
                  <img src="images/almonds.jpg" />
                </figure>
                <div class="nut_text">
                  <h2>Almond 3</h2>
                  <h3 class="rich_in">Rich In</h3>
                  <p>
                    Vitamin E, Monounsaturated fats, Fiber, Biotin, <br />Calcium,
                    Phosphorus, Magnesium, Copper, <br />
                    Phytonutrients, specifically flavonoids, plant sterols,<br />
                    phenolic acids
                  </p>
                </div>
              </div>
              <!-- Nut 3 Ends-->
            </div>
          </div>
          <script
          src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
          integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
          crossorigin="anonymous"
        ></script>
        <script
          src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
          integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
          crossorigin="anonymous"
        ></script>
        <script
          src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
          integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
          crossorigin="anonymous"
        ></script>
        </div>
      </div>
    </div>
    </div>

        <!-- Everything Related to nuts ends here - Slider Ends-->

        <div class="last_contact_us" id="last_contact_us">
          <p class="footer_contact_us">Contact Us</p>
          <p class="footer_contact_us_expl">
            Call us to get Nuts and Spices at a best quality <br />
            and also at a best price
          </p>
        </div>
    <script
          src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
          integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
          crossorigin="anonymous"
        ></script>
        <script
          src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
          integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
          crossorigin="anonymous"
        ></script>
        <script
          src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
          integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
          crossorigin="anonymous"
        ></script>

CSS

body {
  overflow-x:hidden;
}
.centering_the_slider_contents {
  margin-top: 10px;
  padding-top: 25px;
  width: 100%;
  padding-bottom: -25px;
  text-align: center;
  margin-top: 15px auto;
  background: #ebebeb;
  display: flex;

}

.images_in_nuts {
  border-radius: 50%;
  width: 250px;
  height: 250px;
  display: inline-block;
}

.nut_text {
  display: inline-block;
  vertical-align: top;
  margin-top: 30px;
}

// .last_contact_us {
//   background: #ffffff !important;
// }

.footer_contact_us  {
  margin-top: 10px;
  text-align: center;
  font-size: 25px;
  font-family: "Poppins";
  font-weight: bold;
}

.footer_contact_us_expl {
  text-align: center;
  font-family: "Poppins";
}

I couldnt remove that jumb if you could help me with a solution it will really really helpful.

. By adding padding-top 15px; I am trying to get this small spacing

解决方案

body {
  overflow-x:hidden;
}

.about_nuts {
  margin-top: 10px;
  text-align: center;
  font-size: 25px;
  font-family: "Poppins";
  font-weight: bold;
}

.our_services_expl {
  text-align: center;
  font-family: "Poppins";

}

.carousel-item
{
margin:20px 0px;

}

.centering_the_slider_contents {
  width: 100%;
  text-align: center;
  background: #ebebeb;
  display: flex;
 }

.images_in_nuts {
  border-radius: 50%;
  width: 250px;
  height: 250px;
  display: inline-block;
  overflow: hidden;
}

.nut_text {
  display: inline-block;
  vertical-align: top;
  margin-top: 30px;
}

// .last_contact_us {
//   background: #ffffff !important;
// }

.footer_contact_us  {
  margin-top: 10px;
  text-align: center;
  font-size: 25px;
  font-family: "Poppins";
  font-weight: bold;
}

.footer_contact_us_expl {
  text-align: center;
  font-family: "Poppins";
}
<link
    rel="stylesheet"
    href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
    integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
    crossorigin="anonymous"
    />
<div class="about_nuts_main" id="section_about_nuts_main">
    <p class="about_nuts">About Nuts</p>
    <p class="our_services_expl">
        Dont Feel Shy Choose your Favourite Nut and get to know <br/>
        what's inside about it
    </p>
</div>
<!-- About nuts - Slider-->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
    <div class="slider">
        <div class="centering_the_slider_contents">
            <!-- Nut 1-->
            <div class="carousel-item active">
                <figure class="images_in_nuts">
                    <img src="images/almonds.jpg" />
                </figure>
                <div class="nut_text">
                    <h2>Almond</h2>
                    <h3 class="rich_in">Rich In</h3>
                    <p>
                        Vitamin E, Monounsaturated fats, Fiber, Biotin, <br />Calcium,
                        Phosphorus, Magnesium, Copper, <br />
                        Phytonutrients, specifically flavonoids, plant sterols,<br />
                        phenolic acids
                    </p>
                </div>
            </div>
            <!-- Nut 1 Ends-->
            <!-- Nut 2-->
            <div class="carousel-item">
                <figure class="images_in_nuts">
                    <img src="images/almonds.jpg" />
                </figure>
                <div class="nut_text">
                    <h2>Almond 2</h2>
                    <h3 class="rich_in">Rich In</h3>
                    <p>
                        Vitamin E, Monounsaturated fats, Fiber, Biotin, <br />Calcium,
                        Phosphorus, Magnesium, Copper, <br />
                        Phytonutrients, specifically flavonoids, plant sterols,<br />
                        phenolic acids
                    </p>
                </div>
            </div>
            <!-- Nut 2 Ends-->
            <!-- Nut 3-->
            <div class="carousel-item">
                <figure class="images_in_nuts">
                    <img src="images/almonds.jpg" />
                </figure>
                <div class="nut_text">
                    <h2>Almond 3</h2>
                    <h3 class="rich_in">Rich In</h3>
                    <p>
                        Vitamin E, Monounsaturated fats, Fiber, Biotin, <br />Calcium,
                        Phosphorus, Magnesium, Copper, <br />
                        Phytonutrients, specifically flavonoids, plant sterols,<br />
                        phenolic acids
                    </p>
                </div>
            </div>
            <!-- Nut 3 Ends-->
        </div>
    </div>
    <script
        src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
        integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
        crossorigin="anonymous"
        ></script>
    <script
        src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
        integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
        crossorigin="anonymous"
        ></script>
    <script
        src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
        integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
        crossorigin="anonymous"
        ></script>
</div>
</div>
</div>
</div>
<!-- Everything Related to nuts ends here - Slider Ends-->
<div class="last_contact_us" id="last_contact_us">
    <p class="footer_contact_us">Contact Us</p>
    <p class="footer_contact_us_expl">
        Call us to get Nuts and Spices at a best quality <br />
        and also at a best price
    </p>
</div>
<script
    src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
    integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
    crossorigin="anonymous"
    ></script>
<script
    src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
    integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
    crossorigin="anonymous"
    ></script>
<script
    src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
    integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
    crossorigin="anonymous"
    ></script>

Remove padding-top from .centering_the_slider_contents to fix bounce and add top+bottom margin on .carousel-item for space.

这篇关于Bootstrap Carousel弹跳,无法使用HTML和CSS对其进行编辑-包含O/P gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 09:17