Dynamically changing an image in jquery to match the css image -


hopefully i'll explain problem correctly, if not let me know , i'll make edit.

i'm created slide menu when shown, background blurred, working ok when it's static image, issue i'm having when it's slideshow.

this give better understanding of i'm trying do.

http://jsfiddle.net/djm3v/23/

if click red button, background of slide appears blurred, if click next or previous button , show different slide, blurred image remains same, need match slide image.

here's jquery code below.

jquery(document).ready(function($) {   $(".trigger-wrapper").click(function () {     $("#menu-wrapper-left").stop().animate({width: 'toggle'});     $('#hero-container').css('background-image','url(http://dummyimage.com/600x400/000/fff.jpg)');     return false;   }); }); 

the important line is

$('#hero-container').css('background-image','url(http://dummyimage.com/600x400/000/fff.jpg)'); 

this image slide menu using blur, if delete line slide menu use following css image in stylesheet.

#hero-container {   background: url(http://2.bp.blogspot.com/-lwilpqw9zc0/unzm09oxdxi/aaaaaaaahwo/30a7zqsp3je/s1600/blur-static+.jpg) no-repeat 50% fixed;   background-size: cover; } 

either way both wrong it's single, needs use slideshow images depending on slide selected, see below.

.hero li:nth-child(1) span {    background-image: url('http://dummyimage.com/600x400/000/fff.jpg'); } .hero li:nth-child(2) span {   background-image: url('http://2.bp.blogspot.com/-lwilpqw9zc0/unzm09oxdxi/aaaaaaaahwo/30a7zqsp3je/s1600/blur-static+.jpg'); } 

can working example.

i understood question. have used same html, javascript , css file jsfiddle link , have made modification in it. adding css have done modification , jsfiddle link have modified little bit.

css

#menu-wrapper-left {     height:100%;     width:300px;     position: fixed;     display: none;     background:white;     top:0;     opacity:0.5;     z-index:5;     box-shadow: 1px 1px 4px rgba(0,0,0,.3);     left:0px; } 

the completed demo in given jsfiddle link.

http://jsfiddle.net/djm3v/34/


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -