css - Jquery hover_caption plugin hiding transparency, Is it the z-index -
css - Jquery hover_caption plugin hiding transparency, Is it the z-index -
i trying hover overlay black text on white transparencies on imgs in ul, think transparency hiding behind img. i'm using corey schires' hover_caption jquery plugin. here link code.
http://blooming-citadel-2598.herokuapp.com/residential/
and jquery library https://github.com/coryschires/hover-caption
(function($) { $.hover_caption = { defaults: { caption_font_size: '13px', caption_color: 'black', caption_bold: false, caption_default: "fix me" } } $.fn.extend({ hover_caption: function(config) { var config = $.extend({}, $.hover_caption.defaults, config); homecoming this.each(function() { var image = $(this); // set variable wrapper div var width = image.width(); var height = image.height(); // variables caption var caption_padding = width * .07; // dynamic margin depending on img width // set caption title attr if set var caption = image.attr('title') ? image.attr('title') : config.caption_default; // add together necessary html , css image .css({ 'z-index': '0', 'position': 'relative' }) .wrap('<div>') .parent() .css({ 'width': width, 'height': height }) .prepend('<h3>'+ caption +'</h3>') .find('h3') .addclass('hover_caption_caption') // utilize hook additional styling .css({ 'padding': caption_padding, 'color': config.caption_color, 'width': width, 'font-size': config.caption_font_size, 'position': 'absolute', 'margin': 0 }) .hide(); if (config.caption_bold) { image.css('font-weight', 'bold') }; // add together hover event toggle message image.parent().hover(function() { $(this).addclass('hover_caption').find('h3').show(); }, function() { $(this).removeclass('hover_caption').find('h3').hide(); }); }) } }) })(jquery);
he sets z-index of img -1 in jquery, had alter 0 images wouldn't hide under parents. broke everything. images nested in parent hover element div.hover_caption
div.hover_caption { background-image: url(/img/hover_image_white.gif); background-color: rgb(255,255,255, 0.8); z-index: 1000!important; float:left; }
your img tag within div logically beingness set on top of div's background. can't alter behaviour z-index. illustration add together opacity: 0.4
div.hover_caption img
. that'll create image transparent background on div shows through it.
jquery css hover z-index
Comments
Post a Comment