【问题标题】:Issues with hero slider displaying on mobile device在移动设备上显示英雄滑块的问题
【发布时间】:2022-01-08 04:13:21
【问题描述】:

请帮忙,我有一个使用英雄滑块的模板。滑块在桌面上工作正常,但在移动设备上不行。有人告诉我调整 style.css 文件来解决它。

我在这里阅读了一些类似的问题,但没有解决方案。有人可以帮忙吗?

模板所有者说解决方案在 stle.css 中,但无法进一步回应。

有点困惑不要弄乱 style.css 文件。在下面找到英雄滑块的 style.css 代码:

        Hero Area CSS
========================================*/ 
.home-slider {
    overflow: hidden;
}
.hero-slider {
    position: relative;
}
.hero-slider,
.hero-slider .single-slider{
    height:680px;
}
.hero-slider .single-slider {
    background-size: cover;
    background-position: center;
    position: relative;
}
.hero-slider .single-slider .slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0.65;
}
.hero-slider .welcome-text {
    margin: 146px 0 0;
}
.hero-slider .hero-text h4 {
    color: #fff;
    margin-bottom: 10px;
    font-weight: 400;
    display: inline-block;
    background: #2E2751;
    padding: 8px 20px;
    font-size: 16px;
}
.hero-slider .hero-text h4:before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    border-top: 8px solid #2E2751;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
}
.hero-slider .hero-text h1 {
    color: #2E2751;
    font-size: 50px;
    font-weight: bold;
    line-height: 65px;
    margin-bottom: 20px;
    padding-bottom: 20px;
}
.hero-slider .hero-text h1::before {
    content: "";
    position: absolute;
    left: 0;
    width: 50px;
    height: 6px;
    background: #1775b3;
    bottom: -3px;
}
.hero-slider .hero-text .p-text{
    max-width:80%;
}
.hero-slider .hero-text p {
    color: #666;
    font-size: 15px;
}
.hero-slider .hero-text .button {
    margin-top: 30px;
}

/* Text Center */
.hero-slider .hero-text.text-center h1::before {
    left: 50%;
    margin-left: -25px;
}

/* Text Left */
.hero-slider .hero-text.text-right h1::before {
    left: auto;
    right:0;
    margin:0;
}

/* Slider Nav */
.hero-slider .owl-nav{
    margin: 0;
    width: 100%;
}
.hero-slider .owl-carousel .owl-nav div {
    width: 50px;
    height: 60px;
    line-height: 60px;
    background: #1775b3;
    color: #fff;
    position: absolute;
    margin: 0;
    padding: inherit;
    font-size: 30px;
    text-align: center;
    -webkit-transition: all 0.4s ease;
    -moz-transition: all 0.4s ease;
    transition: all 0.4s ease;
    border-radius: 0px;
    top: 50%;
    margin-top: -30px;
}
.hero-slider .owl-carousel .owl-nav div:hover{
    color:#fff;
    background:#2E2751;
}
.hero-slider .owl-carousel .owl-nav .owl-prev{
    left:-100px;
}
.hero-slider:hover .owl-carousel .owl-nav .owl-prev{
    left:0px;
}
.hero-slider .owl-carousel .owl-nav .owl-next{
    right:-100px;
}
.hero-slider:hover .owl-carousel .owl-nav .owl-next{
    right:0px;
}

/* Hero Animations */
.hero-slider .owl-item.active .hero-text h4{
    animation: fadeInUp 0.8s both 1s;
}
.hero-slider .owl-item.active .hero-text h1{
    animation: fadeInRight 1s both 1.2s;
}
.hero-slider .owl-item.active .hero-text p{
    animation: fadeInLeft 1.2s both 1.4s;
}
.hero-slider .owl-item.active .button{
    animation: fadeInUp 1.4s both 1.6s;
}



/* Hero Agency */
.hero-agency .ageny-main {
    padding-top: 158px;
}
.hero-agency .hero-text {
    z-index: 555;
    position: relative;
    text-align: center;
}
.hero-agency .agency-inner {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 800px;
}
.hero-agency .agency-inner:before {
    opacity: 0;
    background: #fff;
}
.hero-agency .hero-text {
    z-index: 555;
    position: relative;
    text-align: center;
}
.hero-agency .hero-text h1 {
    font-size: 55px;
    color: #2E2751;
    font-weight: 700;
    line-height: 65px;
}
.hero-agency .hero-text h1 span {
    color: #1775b3;
}
.hero-agency .hero-text h4 {
    font-weight: 500;
}
.hero-agency .video-head {
    margin-top: 35px;
    position: relative;
}
.hero-agency .video-head .video {
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 100%;
    background: #1775b3;
    color: #fff;
    display: inline-block;
    font-size: 28px;
}
.hero-agency .video-head .video:hover{
    background:#fff !important;
    color:#1775b3;
    -webkit-box-shadow:0px 0px 15px #00000029;
    -moz-box-shadow:0px 0px 15px #00000029;
    box-shadow:0px 0px 15px #00000029;
}
.hero-agency .video-play-main {
    display: inline-block;
    padding: 5px;
    z-index: 3333;
    position: relative;
}
.hero-agency .waves-block .waves {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 2px solid #1775b38a;
    opacity: 0;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    border-radius: 100%;
    -webkit-animation: waves 3s ease-in-out infinite;
    animation: waves 3s ease-in-out infinite;
    left: 50%;
    margin-left: -75px;
    top: 50%;
    margin-top: -75px;
}
.hero-agency .waves-block .wave-1 {
    -webkit-animation-delay: 0s;
    animation-delay: 0s;
}
.hero-agency .waves-block .wave-2 {
    -webkit-animation-delay: 1s;
    animation-delay: 1s;
}
.hero-agency .waves-block .wave-3 {
    -webkit-animation-delay: 2s;
    animation-delay: 2s;
}
@-webkit-keyframes waves {
    0% {
        -webkit-transform: scale(0.2, 0.2);
        transform: scale(0.2, 0.2);
        opacity: 0;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    }
    50% {
        opacity: 0.9;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
    }
    100% {
        -webkit-transform: scale(0.9, 0.9);
        transform: scale(0.9, 0.9);
        opacity: 0;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    }
}
@keyframes waves {
    0% {
        -webkit-transform: scale(0.2, 0.2);
        transform: scale(0.2, 0.2);
        opacity: 0;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    }
    50% {
        opacity: 0.9;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
    }
    100% {
        -webkit-transform: scale(0.9, 0.9);
        transform: scale(0.9, 0.9);
        opacity: 0;
        -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    }
}


/* Agency Feature */
.hero-agency .agency-feature {
    display: block;
    text-align: center;
    margin-top: 40px;
}
.hero-agency .a-feature {
    background: #fff;
    padding: 45px 20px;
    text-align: center;
    z-index: 333;
    position: relative;
    width: 220px;
    display: inline-block;
    margin-right: 20px;
    border-radius: 0;
    box-shadow: -2px 4px 13px rgba(0, 0, 0, 0.12);
    border-top: 2px solid #1775b3;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    transition: all 0.3s ease;
}
.hero-agency .a-feature:hover{
    border-top-color:#1775b3;
    -webkit-transform:scale(1.05);
    -moz-transform:scale(1.05);
    transform:scale(1.05);
}
.hero-agency .a-feature:last-child{
    margin:0;
}
.hero-agency .a-feature i {
    display: inline-block;
    border-radius: 100%;
    font-size: 40px;
    top: -30px;
    background: #fff;
    color: #1775b3;
    left: 50%;
}
.hero-agency .a-feature h4 {
    color: #2E2751;
    font-size: 18px;
    margin-top: 12px;
    margin-bottom: 12px;
    line-height: 22px;
}
.hero-agency .a-feature p {
    line-height: 22px;
    font-size: 14px;
}
/*======================================
   End Hero Area CSS
========================================*/ 

【问题讨论】:

    标签: html css slider hero


    【解决方案1】:

    要重新表述您的问题,您需要将网站设计为可移动的。

    这涉及添加适用于较小屏幕尺寸(或更高,这是您的 CSS)的新 CSS 规则。

    如果您像在这篇流行的 SO 帖子中那样应用 CSS 媒体查询,那么您可能能够解决您的问题:

    CSS media queries for screen sizes

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多