jquery - CSS background-image reference in javascript using codigniter -


i working in codeigniter folder structure that.

application assets     css     js     img system index.php 

i've make bootstrap carousel full window height. approach make div.item layer full height of window using jquery. remove image div.item layer , set image div.item background image using jquery.

here jquery code.

$('.carousel').find('.item img').each(function () {     var $this = $(this),         src = $(this).attr('src');         imagename = 'url(assets/img/' + $(this).attr('src').split('/')[6]+')';     $this.parent().css('background-image',imagename);     $this.remove(); }); 

my reference in not working please let me what's wrong code.

your should use full reference. try this.

$('.carousel').find('.item img').each(function () {     var $this = $(this),     src = $this.attr('src');     $this.parent().css('background-image',src);     $this.remove(); }); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -