Commit ae69006e authored by Étienne Oz's avatar Étienne Oz 🖖

feinte bug thumbnail doc en js

parent c589a248
......@@ -39,7 +39,7 @@
<article class="blog <?php echo $blogPost->name; foreach($categorieItems as $item) echo ' '.$item; ?>">
<h1><a href="<?= $blogPost->url ?>"><?= $blogPost->title ?></a></h1>
<h2 class="date"><?php echo $blogPost->date ? $blogPost->date : date("j/m/y", $blogPost->created); ?></h2>
<img class="vignette" src="<?= $imageFirst->url ?>"/>
<img class="vignette" data-src="<?= $imageFirst->url ?>"/>
</article>
<?php endforeach ?>
......
......@@ -23,7 +23,9 @@ function ImgLegend(article){
var legend = $(this).attr("alt");
$(this).wrap("<figure></figure>");
$(this).after("<figcaption>" + legend + "</figcaption>");
if (legend.length != 0) {
$(this).after("<figcaption>" + legend + "</figcaption>");
}
});
}
......@@ -136,13 +138,6 @@ function articleState(theClass, article, state){
})
}
// function cloneImg(theClass, article, state){
// // var imgBeh = section.find('.behindHover').children('img');
// article.behindHover.each(function(){
// $("img").clone($(this).parent.addClass(".clone"));
// })
// }
function removeCategorie(nav){
var categorie = nav.find('.categorie');
categorie.each(function(){
......@@ -174,6 +169,7 @@ function hoverBlogTitle(blog){
$('.vignette').hide();
blog.find('article').mouseenter(function(){
srcImg($(this));
$(this).children('.vignette').show();
}).mouseleave(function(){
$(this).children('.vignette').hide();
......@@ -239,6 +235,12 @@ function escalier(nav, tagList) {
})
}
function srcImg(el){
var img = el.find('img');
var imgSrc = img.attr('data-src');
img.attr('src', imgSrc);
}
function openAgendaOnLoad(actu){
var hash = window.location.hash;
if (hash) {
......@@ -249,9 +251,7 @@ function openAgendaOnLoad(actu){
agendaMargin(actu);
agendaItem.addClass('open');
agendaItem.find('p, img').show();
var img = agendaItem.find('img');
var imgSrc = img.attr('data-src');
img.attr('src', imgSrc);
srcImg(agendaItem);
var styleAttr = agendaItem.attr('style');
agendaItem.attr('data-style', styleAttr);
agendaItem.removeAttr('style');
......@@ -307,9 +307,7 @@ function openAgendaItem(actu){
actu.find('ul').click(function(){
if (!$(this).hasClass('open')) {
var title = $(this).attr('class').split(' ')[0];
var img = $(this).find('img');
var imgSrc = img.attr('data-src');
img.attr('src', imgSrc);
srcImg($(this));
window.location.hash = title;
$(this).addClass('open');
$(this).find('p, img').show();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment