素材牛VIP会员
点击左右两侧的><按钮,图片会往下移动是为什么呢?
 sh***ng  分类:JavaScript  人气:1155  回帖:3  发布于6年前 收藏

在做一个轮播图,为什么点击左划右划的时候,图片会在点击左边按钮的时候往上走,点击右边的按钮往下走呢?有没有方法解决呢 这是什么问题导致的 哦对了 用了一些bootstrap的样式 本来想直接套用bootstrap插件的但是我这是asp页面导致有图片后台 绑定 不是很好用 所以自己写了一个轮播图的


补充下题主的代码,他写评论里了(ー_ー)!!

<!--ChangePicContainer-->

            <div style="background-color: #94618E; height: 440px; border-radius: 10px;" class="col-md-8">
                <div id="myCarousel" class="carousel slide">
                    <!-- 轮播(Carousel)指标 -->
                    <div class="carousel-inner">
                        <!-- 轮播(Carousel)项目 -->
                        <asp:DataList ID="DataList1" runat="server" RepeatLayout="Flow">
                            <ItemTemplate>
                                <div class='item' style="display: none;cursor:pointer;margin-bottom:0;margin-left:0">
                                    <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("imgCarouselUrl") %>'/>
                                    <div class="carousel-caption" style="margin-bottom:90px;font-size:40px;font-family:'Sigmar One';">
                                        <asp:Label ID="Label1" runat="server" Text='<%#Eval("imgCarouselIntro") %>'></asp:Label>
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:DataList>
                    </div>
                    <!-- 轮播(Carousel)导航 -->
                    <a class="carousel-control left" href="#myCarousel" id="prevBtn">&lsaquo;</a>
                    <a class="carousel-control right" href="#myCarousel" id="nextBtn">&rsaquo;</a>
                </div>
        </div>
 标签:jqueryjavascript

讨论这个帖子(3)垃圾回帖将一律封号处理……

Lv6 码匠
飞***n 技术总监 6年前#1

贴代码啊 你给我图我yy你哪里错么

Lv5 码农
Ca***on 职业无 6年前#2

只能对每个img设定他的margin-top值来让他充满整个框框 这是我想的最辣鸡的办法 有没有更好的 可以一下子适配所有的图片的 不要对图片都进行个别处理???

Lv4 码徒
go***le 学生 6年前#3

打上debugger;点击的时候看看是不是图片的大小发生变化了

 文明上网,理性发言!   😉 阿里云幸运券,戳我领取