2

如果你能帮助我,我的悬停翻转 href 链接在 ipad/iphone 上的触摸有问题。

我希望我的框在 ipad 上第一次触摸时悬停在图像上,然后能够再次触摸以将用户发送到另一个页面。目前链接不会显示。我努力不知道该怎么做。

HTML:

<!-- IMAGE CONTAINER -->
<div class="image-container">
   <div class="image-container-overflow">
      <div class="image-container-actual">
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
         <div class="image">
            <img src="http://www.placehold.it/188x188" />
            <div class="hoverimg">
               <a href="success.html">
                  <img class="fade" src="_includes/img/global/image2.jpg" width="188" height="188" />
                  <p>Helen was offered a job as a florist two weeks after she completed her Pinewood training. <br><br><strong>See Success Stories</strong></p>
               </a>
            </div>
         </div>
      </div>
   </div>
</div>
<!-- IMAGE CONTAINER -->

CSS:-

/* Editable Multiple Image Area */
.image-container {
    width: 100%;
    margin: 0;
    padding: 0;
    height: 360px;
    overflow: hidden;
}

.internal .image-container {
    width: 100%;
    margin: 0;
    padding: 0;
    height: 180px;
    overflow: hidden;
}

.contact .image-container {
    width: 100%;
    margin: 0;
    padding: 0;
    height: 180px;
    overflow: hidden;
}

.image-container-overflow {
    width: 100%;
    padding-right: 187px;
    height: 360px;
    position: relative;
}

.image-container-actual {
    width: 100%;
    height: 360px;
    position: absolute;
    top: 0;
    left: 0;
}

.image {
    position: relative;
    float: left;
    width: 188px;
    height: 188px;
    margin: 0;
    padding: 0;
}

.image img {
    position: absolute;
    z-index: 1;
    left: 0;
    top: 0;
}

.image:hover div {
    display: block!important;
}

.image img:hover div {
    display: none;
    position: absolute;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: #f28f0a;
}

.hoverimg {
    display: none;
    position: absolute;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: #f28f0a;
}

.hoverimg p {
    font-family: 'ralewayregular';
    color: #fff;
    position: absolute;
    z-index: 3;
    font-weight: normal;
    margin: 30px;
    font-size: 12px;
    letter-spacing: .5px;
    line-height: 18px;
}

.fade {
    opacity: 1;
    transition: opacity .25s ease-in-out;
    -moz-transition: opacity .25s ease-in-out;
    -webkit-transition: opacity .25s ease-in-out;
}

.fade:hover {
    opacity: 0.2;
}

这是小提琴:- http://jsfiddle.net/m67k8/

如果有人有想法,我将不胜感激任何帮助。

4

1 回答 1

0

我会使用 JavaScript/JQuery 来做到这一点。无论是否显示悬停内容,单击(触摸)的链接都需要采取不同的行为,因此我认为最快和最简单的方法是在打开时在 .hoverimg 上添加一个类,然后编写一个带有条件的函数来控制链接的行为如下:

$('.hoverimg a').click(function(e) {
    if ( !$(this).parent('.hoverimg').hasClass('on') ) {
        e.preventDefault();
        $(this).parent('.hoverimg').addClass('on').css('display', 'block');
    }
});

这是小提琴:http: //jsfiddle.net/m67k8/1/

于 2013-11-05T15:20:29.017 回答