我正在使用以下代码从我网站上的链接创建图库。我知道没有完全保护图像,但想在图像上添加透明覆盖。我可以通过将图像放在div标签中并使用css来查看这样做的方法,但我不确定是否适合我正在使用的javascript。
有没有人有办法在javascript中添加叠加层?
<script type="text/javascript">
var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [250, 180], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
imagearray: [
["gallery/img1.png", "", "_new", "© me"],
["gallery/img2.png", "", "_new", "© me"],
["gallery/img3.png", "", "_new", "© me"],
],
autoplay: [true, 2500, 2], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
},
onslide:function(curslide, i){ //event that fires after each slide is shown
//Keyword "this": references current gallery instance
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}
})
</script>
答案 0 :(得分:0)
在图库上添加透明div。
你可以这样做:
.overlay {
height : 100px; // height and width of your gallery
width : 200px;
z-index: 2000000!important;
opacity:0.00001;
position:absolute;
}