-1

I want to use this html template: http://www.graphberry.com/item/smak-html-single-page-template

It works fine in the live preview, but when I downloaded it and click on any of the gallery picture, it opens an alert window saying: error.

I've tried to find the error, but I don't see any trouble. My suspect goes on the main.js file, in this line:

var singleProject = $('#single-project');

but I don't have much experience regarding javascript.

Appreciate any help!

M.suleman Khan
  • 576
  • 6
  • 17
isk27
  • 329
  • 2
  • 5
  • 13
  • #single-project is an id for a html tag – Nihal Jul 16 '17 at 06:15
  • When I refer to that line, I don't mean that is the id what is wrong or asking what it is... I mean there is something related to the line causing the error, could be the use of that variable in the function, could be an error in the definition... anyway, the thing is that is not working and I can't find what is wrong – isk27 Jul 16 '17 at 17:24

1 Answers1

0

When you see the dollar sign in javascript, as in var singleProject = $('#single-project');, you will need the jQuery library.

You will need this script in your code:

<script
  src="https://code.jquery.com/jquery-3.2.1.min.js"
  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  crossorigin="anonymous"></script>

That is the latest jQuery CDN, which imports jQuery into your project.

Add this script in your <head> tag. More info: https://www.w3schools.com/jquery/jquery_get_started.asp

rpivovar
  • 3,150
  • 13
  • 41
  • 79
  • Well, they already have the jquery library loaded at the end of the index.html, but I've tried your solution and didn't work, I also notice when changing the src of the jquery lib to the CDN src, the website doesn't load... I don't understand that neither :/ – isk27 Jul 16 '17 at 17:28
  • @isk27 Make sure `JQuery` is above your script. – u32i64 Jul 16 '17 at 17:39