简体   繁体   English

如何使轮播中的每个图像均可点击并指向不同的URL

[英]How to make each image in a carousel clickable and pointing to a different URL

I need to make each image in carousel to be click able and point to separate urls. 我需要使轮播中的每个图像都能够单击并指向单独的网址。 Any suggestions as how could I achieve it? 有什么建议可以实现吗?

My HTML - 我的HTML-

<ul id="flexiselDemo3">
            <li><img src="images/1.jpg" height='100' width='150' /><a href="http://"></a></li>
            <li><img src="images/2.jpg" height='100' width='150' /><a href="http://"></a></li>
            <li><img src="images/3.jpg" height='100' width='150' /><a href="http://"></a></li>
            <li><img src="images/4.jpg" height='100' width='150' /><a href="http://"></a></li>                                                 
        </ul> 

How to make each image click able? 如何使每个图像都能点击? I am unable to fit anchor tag as such. 我无法像这样固定锚标记。

Wrap you image with anchor tag 用锚标签包裹图像

<ul id="flexiselDemo3">
    <li>
        <a href="http://somedomain.com">
            <img src="images/1.jpg" height='100' width='150' />
        </a>
    </li>
    <li>
        <a href="http://somedomain1.com">
            <img src="images/2.jpg" height='100' width='150' />
        </a>
    </li>
    <li>
        <a href="http://somedomain2.com">
            <img src="images/3.jpg" height='100' width='150' />
        </a>
    </li>
    <li>
        <a href="http://somedomai3.com">
            <img src="images/4.jpg" height='100' width='150' />
        </a>
    </li>
</ul>

just wrap you image with the following anchor tag 只需用以下锚标签包裹您的图像

 <li>
    <a href="http://your link">
        <img src="images/1.jpg" height='100' width='150' />
    </a>
</li>
<ul id="flexiselDemo3">
            <li><a href="http://"><img src="images/1.jpg" height='100' width='150' /></a></li>
            <li><a href="http://"><img src="images/2.jpg" height='100' width='150' /></a></li>
            <li><a href="http://"><img src="images/3.jpg" height='100' width='150' /></a></li>
            <li><a href="http://"><img src="images/4.jpg" height='100' width='150' /></a></li>                                                 
        </ul>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM