简体   繁体   English

Wordpress CSS悬停图像作为小部件?

[英]Wordpress CSS Hover Image as Widget?

I'm currently trying to make a website for someone who's not very tech friendly and part of the website spec is that there are 8 images on the front page that are meant to have a rollover image that link to their corresponding categories. 我目前正在尝试为不太技术友好的人创建一个网站,并且网站规格的一部分是,首页上有8张图像,这些图像都具有链接到其相应类别的过渡图像。 Now I know this would be pretty easy in css or javascript but I want the client to be able to re-arrange the order of these images using the widget functionality whilst also having the ability to replace an image, give it a new link and set the mouseover image without touching any of the code. 现在我知道这在CSS或javascript中非常简单,但我希望客户端能够使用小部件功能重新排列这些图像的顺序,同时还具有替换图像,为其提供新链接和设置的功能。鼠标悬停图像,而无需触摸任何代码。

What i've tried so far is using the wordpress simple image plugin (which gives the widget and link functionality) along with the widget css class selector in an attempt to make the client able to select the relevant category class which would have a preset rollover image in the css but I don't think it can be accomplished this way. 到目前为止,我一直在尝试使用wordpress简单图像插件(提供小部件和链接功能)以及小部件css类选择器,以使客户端能够选择具有预设翻转的相关类别类。图像在CSS中,但我认为无法通过这种方式完成。

any suggestions? 有什么建议么?

As per i understand, It can be done by simple html/css no need to use any plugin just you have to do some development and give the functionality to upload and update images with related links.

make one simple Div structure and give display property in css to get hover effect.
just make one structure and make it into a loop so client can move it any where in given area.
Simple structure as below.

HTML:
<div class="img_block">
    <img src="something.jpg" alt="" />
    <div class="hover_block">
        <a href="www.stackoverflow.com">
            <img src="another.jpg" alt="" />
        </a>
    </div>
</div>

Css:
.img_block {}
.hover_block{display:none; position:absolute; left:0; top:0;}
.hover_block img{width:100%; height:100%;}/* If require */
.img_block:hover .hover_block{display:block;}

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

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