Search code examples
phpjqueryhtmlcssjgrowl

How to blur and transparant only background and not content in jgrowl notification


i tried blur and transparant jgrowl notification background, but just transparant works. when blur the content also blur. content mean text notification. i wan't background transparant and blur and not content. THIS jsfiddle

CSS:

.test{
background-color:rgba(102, 204, 153,0.95);
color:#fff;
font-weight:bold;
border:1px #fff solid;
filter: blur(5px) ;
}

JGROWL :

<script type="text/javascript">
    $(function() {
    $.jGrowl("<p class='upper'><i class='fa fa-exclamation-triangle' aria-hidden='true'></i> <?=$row['NTFY_TTL'];?></p><?=$row['NTFY_DESC'];?><br> <small>Posted <?=$row['BEG_DT'];?></small>", { 
        theme: 'test',
        position: 'top-right',
        life: 3000 
    });
    });
</script>

THIS jsfiddle


Solution

  • There could be a better way but alternatively can be done with the help of empty div Please check required browser compatibility before implementation

    jsfiddle demo

    HTML

    <div class="test">
    <span class="test2">
    
      </span>
    
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Labore quod atque ipsam cupiditate eum, debitis illo repudiandae aperiam dolorum quae neque praesentium, quis vero iure distinctio natus quisquam consequuntur officiis.
    
    
    
    </div>
    

    CSS

    .test {
        position: relative;  
        z-index: 10;
    }
    
    .test2{
        background-color:rgba(102, 204, 153,0.95);
        color:#fff;
        font-weight:bold;
        border:1px #fff solid;
        filter: blur(5px) ;
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        z-index: -1;
    }