add equalizer for images on product plugin, allow animate option to be dynamically set

This commit is contained in:
aatish 2018-12-09 21:21:41 +05:45
parent 66538f7335
commit ddb9c5d901
3 changed files with 35 additions and 1 deletions

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-12-09 15:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ungleich_page', '0020_auto_20180320_0216'),
]
operations = [
migrations.AddField(
model_name='ungleichproduct',
name='animate',
field=models.BooleanField(default=True),
),
]

View file

@ -144,6 +144,7 @@ class UngleichProductItem(ServiceItem):
class UngleichProduct(Service):
section_class = models.CharField(max_length=100, default="", blank=True)
animate = models.BooleanField(default=True)
class UngleichCustomer(Service):

View file

@ -8,7 +8,7 @@
</div>
<div class="row">
{% for plugin in product_instance.child_plugin_instances %}
<div class="col-md-4 col-sm-6 portfolio-item wow fadeInUp" data-wow-delay="{{ forloop.counter|multiply:0.25 }}s" style="visibility: visible; animation-delay: {{ forloop.counter|multiply:0.25 }}s; animation-name: fadeInUp;">
<div class="col-md-4 col-sm-6 portfolio-item sameheight-{{product_instance.pk}} {% if product_instance.animate %}wow fadeInUp{%endif%}" data-wow-delay="{{ forloop.counter|multiply:0.25 }}s" style="visibility: visible; animation-delay: {{ forloop.counter|multiply:0.25 }}s; animation-name: fadeInUp;">
{% render_plugin plugin %}
</div>
{% endfor %}
@ -16,3 +16,16 @@
</div>
</div>
</section>
<script>
$( document ).ready(function() {
var equalizer = ".sameheight-{{product_instance.pk}}"
var heights = $(equalizer).map(function() {
return $(this).height();
}).get(),
maxHeight = Math.max.apply(null, heights);
$(equalizer).height(maxHeight);
});
</script>