光滑的旋转木马将焦点图像拉伸到移动设备上的全屏幕

时间:2016-10-23 19:52:27

标签: jquery mobile carousel slick.js

我使用Ken Wheeler的Slick为我的摄影网站设置了我的旋转木马。

我不希望它继续在手机(或任何小的)上运行旋转木马,所以我将整个部分设置为显示:隐藏然后将其换成图像的简单块显示(无旋转木马)在那个屏幕尺寸。因此,任何观看大约750像素或更大的人都可以看到轮播。那部分没问题。

问题是,Carousel在桌面上完美运行,但是当我在平板电脑上查看时,slideToShow:3的选项不起作用。相反,中心图像(焦点中的图像)被拉伸以填充屏幕,使尺寸变形。

不理解为什么在功能上的运行方式与在大小相同宽度的桌面浏览器上查看它的方式不同,但事实并非如此。同样,它可以在桌面上完美地工作。

我的网站是:

http://philippenewman.com/photography/sanfrancisco.html

非常感谢您提供的任何帮助!

<!DOCTYPE html>
<html>

<head>
<title>Slick Playground</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="./css/slick/slick.css">
<link rel="stylesheet" type="text/css" href="./css/slick/slick-theme.css">

<!-- External Stylesheets-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">

<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">


<!-- External Stylesheets-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">

<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<!--  Jquery-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

<!-- Latest compiled and minified Bootstrap JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<!-- Stylesheets-->
<link rel="stylesheet" href="./css/style.css" type="text/css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<!-- Stylesheets-->
<link rel="stylesheet" href="./css/style.css" type="text/css">
<style type="text/css">
    html,
    body {
        margin: 0;
        padding: 0;
    }

    * {
        box-sizing: border-box;
    }

    .slider {
        width: 90%;
        margin: 0 auto;
        margin-top: 100px;
    }

    .slick-slide {
        margin: 0px 20px;
    }

    .slick-slide img {
        width: 100%;
        max-height: 600px;
    }

    .slick-prev:before,
    .slick-next:before {
        color: white;
    }
</style>

<!--BEGIN NAVBAR-->
<nav class="navbar navbar-inverse navbar-fixed-top navbar-custom">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">philippe newman <span style="color:#99b3ff">photography</span></a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Galleries <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="sanfrancisco.html">San Francisco</a></li>
                        <li><a href="#">California</a></li>
                    </ul>
                </li>
                <li>
                    <a href="process_production.html">process + production</a>
                </li>
                <li>
                    <a href="contact.html">Contact</a>
                </li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
</nav>
<!--END NAVBAR-->


<!--   BEGIN MAIN CONTENT HERE-->
<main class="main">

<!--       This section is for large tablet/Desktop views-->
    <section class="variable slider hidden-xs">
        <div>
            <img src="./images/photography/san_francisco/caltrain_lights_9_7_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/embarcadero_sunset_10_7_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/golden_gate_bridge_dusk_10_10_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/mission_st_alley_graffiti_san_francisco_8_26_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/metreon_sf_intersection_night_8_13_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/marshal_beach_sunset_second_10_19_2016.jps" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/cathedral_of_st_mary_san_francisco_7_20_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/sf_windmill_night_9_30_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/sutro_baths_sunset_second_shot_6_18_2016.jpg" class="img-responsive">
        </div>
        <div>
            <img src="./images/photography/san_francisco/seacliff_sunset_6_21_2016.jpg" class="img-responsive">
        </div>
    </section>

<!--        This section is for our mobile/tablet view only-->
    <section class="mobile-gallery hidden-sm hidden-md hidden-lg">
        <div class="container">
            <div class="row">
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/caltrain_lights_9_7_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/embarcadero_sunset_10_7_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/golden_gate_bridge_dusk_10_10_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/mission_st_alley_graffiti_san_francisco_8_26_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/metreon_sf_intersection_night_8_13_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/marshal_beach_sunset_second_10_19_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/cathedral_of_st_mary_san_francisco_7_20_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/sf_windmill_night_9_30_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/sutro_baths_sunset_second_shot_6_18_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
                <div class="col-xs-12 photo-row">
                    <img src="./images/photography/san_francisco/seacliff_sunset_6_21_2016_thumbnail.jpg" class="img-responsive center-block">
                </div>
            </div>
        </div>
    </section>
</main>

<script src="https://code.jquery.com/jquery-2.2.0.min.js" type="text/javascript"></script>
<!--    JS file for Slick Scroller carousel-->
<script src="./js/slick/slick.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(document).on('ready', function () {
        $(".variable").slick({
            infinite: true,
            variableWidth: true,
            slidesToShow: 3,
            draggable: true,
            centerMode: true,
            swipeToSlide: true
        });
    });
</script>



</body>

</html>

0 个答案:

没有答案