首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在移动设备上显示英雄滑块的问题

在移动设备上显示英雄滑块的问题
EN

Stack Overflow用户
提问于 2021-12-01 14:57:50
回答 1查看 44关注 0票数 1

请帮助,我有一个模板,使用英雄滑块。滑块在桌面上运行良好,但在移动设备上就不行了。我被告知要调整style.css文件来解决它。

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

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

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

代码语言:javascript
复制
        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
========================================*/ 

EN

回答 1

Stack Overflow用户

发布于 2021-12-02 05:47:15

换句话说,你需要将网站设计成移动化的。

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

如果你像在这篇流行的SO post中那样应用CSS媒体查询,那么你也许能够解决你的问题:

CSS media queries for screen sizes

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70186430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档