Merge branch 'Kerl/descriptions_spectacles'

This commit is contained in:
Martin Pépin 2016-09-11 02:40:20 +02:00
commit 7fab931520

View file

@ -34,6 +34,7 @@
</style> </style>
<meta charset="utf8" /> <meta charset="utf8" />
</head> </head>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<body> <body>
{% for show in shows %} {% for show in shows %}
<table class="descTable"> <table class="descTable">
@ -59,11 +60,40 @@
</tr> </tr>
{% if show.image %} {% if show.image %}
<tr> <tr>
<td colspan="2"><p style="text-align:center;"><a href="{{ show.ext_link }}"><img style="display: inline;" src="{{ MEDIA_URL }}{{ show.image }}" alt="{{ show.title }}" height="500px"></a></p></td> <td colspan="2"><p style="text-align:center;"><a href="{{ show.ext_link }}"><img class="imgDesc" style="display: inline;" src="{{ MEDIA_URL }}{{ show.image }}" alt="{{ show.title }}"></a></p></td>
</tr> </tr>
{% endif %} {% endif %}
</tbody> </tbody>
</table> </table>
{% endfor %} {% endfor %}
<script>
// Correction de la taille des images
$(document).ready(function() {
$(".imgDesc").on("load", function() {
// Dimensions
origHeight = 500; // Hauteur souhaitée
w = $(this).width();
h = $(this).height();
r = w/h; // Ratio de l'image
maxWidth = $(this).parent().width();
if (r * origHeight > maxWidth)
{
$(this).width(maxWidth);
$(this).height(maxWidth/r);
}
else
{
$(this).width(r * origHeight);
$(this).height(origHeight);
}
});
});
</script>
</body> </body>
</html> </html>