Image Grid Div不会显示onClick

时间:2016-08-07 05:11:01

标签: javascript jquery html

我有一个图像网格,我试图在溢出的容器(。工作带) onClick中显示我的div (。thumb-unit)。 ..

Jade(HTML)

li.art.illustration.animation-element.fade-in
   .thumb-unit(style="background-image: url(/images/giovanni.png)")
   .thumb-overlay
      p Giovanni

的Javascript

function workLoad(){ $.ajaxSetup({ cache: false }); $('.thumb-overlay').click(function() {
var $this = $(this),
  newTitle = $this.find('p').text(),
  newImage = $('.thumb-unit').show();
$('.project-load').load(newImage);
$('.project-title').text(newTitle);});}

newTitle 显示onClick但 newImage 不显示。

修正了HTML拼写错误,但变量 newImage 仍未呈现。

有什么想法吗?我们都很感激你!

2 个答案:

答案 0 :(得分:0)

您的jaded HTML代码错误。我会给你一个提示:

.thumb-unit(style =“background-image:url(/images/giovanni.png --->”< ---)

答案 1 :(得分:0)

你错过了一个' )'在.png

之后的代码中

应该是:

li.art.illustration.animation-element.fade-in
   .thumb-unit(style="background-image: url(/images/giovanni.png)")
   .thumb-overlay
      p Giovanni