0

On a website I'm using right now there is a slider that pulls in random photos of different sizes. To keep the slider uniform and looking neat I through an image over top of the rotating images to act like a border, there is a hole that you can see the images through. It looks and works great. The person the website is for wants the images to be clickable, I tried putting the anchor tag on and when I click it leads no where because even though there is a hole in the image its acting as if there is something there. I have looked up how to fix this but I can't find any information anywhere.

Does anybody know if this is possible? I am willing to use jquery if need be but I'm stuck

    <div id="right">
     <div class="border-image">
     <img src="images/border.png" />
</div>
<div class="cyclepictures">
<div>
<a href=''><img src="" style="position: relative!important; margin: auto!important; padding-top: 30px;" /></a>
<a href=''><img src="" style="position: relative!important; margin: auto!important; padding-top: 30px;" /></a>
<a href=''><img src="" style="position: relative!important; margin: auto!important; padding-top: 30px;" /></a>
<a href=''><img src="" style="position: relative!important; margin: auto!important; padding-top: 30px;" /></a>
<a href=''><img src="" style="position: relative!important; margin: auto!important; padding-top: 30px;" /></a>
</div>

</div>

This is being generated through an image slider

4

2 に答える 2

0

Jクエリ:

$('.border-image').on('click', function(){
    $('a.active').trigger('click'); // assuming your current image's anchor has active class.
});

ボーダー画像がクリックされるとすぐに、現在アクティブなアンカー/画像のクリックが上記を使用して発生します。これは、ケンが上で提案したのと同じ行にあります。

于 2013-08-15T18:24:56.213 に答える
0

これを行うにはonclick="window.location.href='#link'"、イメージに次を追加する必要があります。

<img src="#" onclick="window.location.href='#link'"/>

また、通常のリンクにカーソルを合わせたときと同じようにマウス カーソルを変更したい場合もあるのでcursor:pointer、画像に style 属性を追加する必要があります。

于 2013-08-15T18:24:59.383 に答える