[FIX] Carousel, add slide

bzr revid: fp@openerp.com-20130915161401-h9wg36481ayaj2qu
This commit is contained in:
Fabien Pinckaers 2013-09-15 18:14:01 +02:00
parent e50f8cf342
commit 74285592a1
2 changed files with 12 additions and 12 deletions

View File

@ -765,8 +765,8 @@
this._super();
var self = this;
this.$editor.find(".js_add").on('click', this.on_add);
this.$editor.find(".js_remove").on('click', this.on_remove);
this.$editor.find(".js_add").on('click', self, this.on_add);
this.$editor.find(".js_remove").on('click', self, this.on_remove);
//background
@ -805,19 +805,19 @@
},
on_add: function (e) {
e.preventDefault();
var $inner = this.$target.find('.carousel-inner');
var $inner = e.data.$target.find('.carousel-inner');
var cycle = $inner.find('.item').size();
$inner.append(this.$('> .item'));
this.$target.carousel(cycle);
$inner.find('.item.active').clone().removeClass('active').appendTo($inner);
e.data.$target.carousel(cycle);
},
on_remove: function (e) {
e.preventDefault();
var $inner = this.$target.find('.carousel-inner');
var $inner = e.data.$target.find('.carousel-inner');
if ($inner.find('.item').size() > 1) {
$inner
.find('.item.active').remove().end()
.find('.item:first').addClass('active');
this.$target.carousel(0);
e.data.$target.carousel(0);
}
},
});

View File

@ -74,11 +74,11 @@
<div id="myCarousel" class="oe_snippet_body carousel slide" data-interval="10000">
<!-- Carousel items -->
<div class="carousel-inner" style="height: 280px">
<div class="item text_only active" style="background-image: url(/website/static/src/img/banner/color_splash.jpg); background-size: cover;">
<div class="item image_text active" style="background-image: url(/website/static/src/img/banner/color_splash.jpg); background-size: cover;">
<div class="container">
<div class="carousel-caption content">
<h1>Create Awesome Websites</h1>
<h3>Super easy, fully flexible</h3>
<h1>Set Your Banner Title</h1>
<h3>Customize with the top-left menu</h3>
<p>
<a href="/page/website.contactus" class="btn btn-success btn-large">Contact us</a>
</p>
@ -90,8 +90,8 @@
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev"></a>
<a class="carousel-control right" href="#myCarousel" data-slide="next"></a>
<a class="carousel-control left" href="#myCarousel" data-slide="prev" style="width: 10%"></a>
<a class="carousel-control right" href="#myCarousel" data-slide="next" style="width: 10%"></a>
</div>
</div>