simpleLightbox is not a function - jquery The Next CEO of Stack OverflowIs there an “exists” function for jQuery?Add table row in jQueryHow do I check if an element is hidden in jQuery?var functionName = function() vs function functionName() Setting “checked” for a checkbox with jQuery?How to check whether a checkbox is checked in jQuery?Disable/enable an input with jQuery?How can I refresh a page with jQuery?jQuery scroll to element“Thinking in AngularJS” if I have a jQuery background?

What's the point of interval inversion?

What can we do to stop prior company from asking us questions?

Is HostGator storing my password in plaintext?

Why here is plural "We went to the movies last night."

Increase performance creating Mandelbrot set in python

What do "high sea" and "carry" mean in this sentence?

How do I construct this japanese bowl?

Robert Sheckley short story about vacation spots being overwhelmed

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

How can I open an app using Terminal?

If the heap is initialized for security, then why is the stack uninitialized?

How to make a variable always equal to the result of some calculations?

How do spells that require an ability check vs. the caster's spell save DC work?

Shade part of a Venn diagram

Need some help with wall behind rangetop

Why do professional authors make "consistency" mistakes? And how to avoid them?

Inappropriate reference requests from Journal reviewers

WOW air has ceased operation, can I get my tickets refunded?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

Does the Brexit deal have to be agreed by both Houses?

Customer Requests (Sometimes) Drive Me Bonkers!

Whats the best way to handle refactoring a big file?

Visit to the USA with ESTA approved before trip to Iran



simpleLightbox is not a function - jquery



The Next CEO of Stack OverflowIs there an “exists” function for jQuery?Add table row in jQueryHow do I check if an element is hidden in jQuery?var functionName = function() vs function functionName() Setting “checked” for a checkbox with jQuery?How to check whether a checkbox is checked in jQuery?Disable/enable an input with jQuery?How can I refresh a page with jQuery?jQuery scroll to element“Thinking in AngularJS” if I have a jQuery background?










0















I am trying to use simpleLightbox in my project, i installed it via:




npm install simplelightbox




and my html structure is like this:



<div class="gallery-wrapper">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
</div>


When I try to initialise lightbox in my main.js file, i get an error that its not a function. I try to do it like the documentation says:



var lightbox = $('.gallery a').simpleLightbox(options);


Anyone has an advice?










share|improve this question

















  • 2





    Where are you importing the simpleLightbox script?

    – Jacob Heater
    Mar 7 at 14:42











  • @JacobHeater ah... that was the issue.. but still not managing to make it work for some reason....

    – Nemanja G
    Mar 7 at 15:18











  • I've come up with a sample in Node using express. I assume that's what you're using. I'll post the example below.

    – Jacob Heater
    Mar 7 at 15:19
















0















I am trying to use simpleLightbox in my project, i installed it via:




npm install simplelightbox




and my html structure is like this:



<div class="gallery-wrapper">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
</div>


When I try to initialise lightbox in my main.js file, i get an error that its not a function. I try to do it like the documentation says:



var lightbox = $('.gallery a').simpleLightbox(options);


Anyone has an advice?










share|improve this question

















  • 2





    Where are you importing the simpleLightbox script?

    – Jacob Heater
    Mar 7 at 14:42











  • @JacobHeater ah... that was the issue.. but still not managing to make it work for some reason....

    – Nemanja G
    Mar 7 at 15:18











  • I've come up with a sample in Node using express. I assume that's what you're using. I'll post the example below.

    – Jacob Heater
    Mar 7 at 15:19














0












0








0








I am trying to use simpleLightbox in my project, i installed it via:




npm install simplelightbox




and my html structure is like this:



<div class="gallery-wrapper">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
</div>


When I try to initialise lightbox in my main.js file, i get an error that its not a function. I try to do it like the documentation says:



var lightbox = $('.gallery a').simpleLightbox(options);


Anyone has an advice?










share|improve this question














I am trying to use simpleLightbox in my project, i installed it via:




npm install simplelightbox




and my html structure is like this:



<div class="gallery-wrapper">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
<img class="image" src="../../../../assets/images/sample/book.png" alt="">
</div>


When I try to initialise lightbox in my main.js file, i get an error that its not a function. I try to do it like the documentation says:



var lightbox = $('.gallery a').simpleLightbox(options);


Anyone has an advice?







javascript jquery






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 14:29









Nemanja GNemanja G

2471925




2471925







  • 2





    Where are you importing the simpleLightbox script?

    – Jacob Heater
    Mar 7 at 14:42











  • @JacobHeater ah... that was the issue.. but still not managing to make it work for some reason....

    – Nemanja G
    Mar 7 at 15:18











  • I've come up with a sample in Node using express. I assume that's what you're using. I'll post the example below.

    – Jacob Heater
    Mar 7 at 15:19













  • 2





    Where are you importing the simpleLightbox script?

    – Jacob Heater
    Mar 7 at 14:42











  • @JacobHeater ah... that was the issue.. but still not managing to make it work for some reason....

    – Nemanja G
    Mar 7 at 15:18











  • I've come up with a sample in Node using express. I assume that's what you're using. I'll post the example below.

    – Jacob Heater
    Mar 7 at 15:19








2




2





Where are you importing the simpleLightbox script?

– Jacob Heater
Mar 7 at 14:42





Where are you importing the simpleLightbox script?

– Jacob Heater
Mar 7 at 14:42













@JacobHeater ah... that was the issue.. but still not managing to make it work for some reason....

– Nemanja G
Mar 7 at 15:18





@JacobHeater ah... that was the issue.. but still not managing to make it work for some reason....

– Nemanja G
Mar 7 at 15:18













I've come up with a sample in Node using express. I assume that's what you're using. I'll post the example below.

– Jacob Heater
Mar 7 at 15:19






I've come up with a sample in Node using express. I assume that's what you're using. I'll post the example below.

– Jacob Heater
Mar 7 at 15:19













1 Answer
1






active

oldest

votes


















3














This example works fine for me. My setup uses a very basic structure with one image book.jpg, but it works, and the gallery operates as intended. Let me know if you have any questions.



Dependencies



npm install --save simplelightbox



HTML



<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="./scripts/jquery.js"></script>
<script src="./scripts/simple-lightbox.js"></script>
<link href="./scripts/simplelightbox.css" rel="stylesheet" />
</head>

<body>
<div class="gallery">
<a href="./assets/book.jpg">Book 1</a>
<a href="./assets/book.jpg">Book 2</a>
<a href="./assets/book.jpg">Book 3</a>
<a href="./assets/book.jpg">Book 4</a>
</div>

<script>
$(function()
$('.gallery a').simpleLightbox();
);
</script>
</body>

</html>


Node/Express



const express = require('express');

const app = express();
const port = 5544;

app.use('/scripts', express.static(__dirname + '/node_modules/jquery/dist'));
app.use('/scripts', express.static(__dirname + '/node_modules/simplelightbox/dist'));
app.use('/assets', express.static(__dirname + '/assets'));

app.get('/', (req, res) => res.sendFile(__dirname + '/index.html'));
app.listen(port, () => console.log(`Listening on port $port`));


Assets Folder



assets/
- book.jpg





share|improve this answer

























  • In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

    – Nemanja G
    Mar 7 at 16:01











  • @NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

    – Jacob Heater
    Mar 7 at 16:46











  • I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

    – Nemanja G
    Mar 8 at 9:04











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55046191%2fsimplelightbox-is-not-a-function-jquery%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














This example works fine for me. My setup uses a very basic structure with one image book.jpg, but it works, and the gallery operates as intended. Let me know if you have any questions.



Dependencies



npm install --save simplelightbox



HTML



<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="./scripts/jquery.js"></script>
<script src="./scripts/simple-lightbox.js"></script>
<link href="./scripts/simplelightbox.css" rel="stylesheet" />
</head>

<body>
<div class="gallery">
<a href="./assets/book.jpg">Book 1</a>
<a href="./assets/book.jpg">Book 2</a>
<a href="./assets/book.jpg">Book 3</a>
<a href="./assets/book.jpg">Book 4</a>
</div>

<script>
$(function()
$('.gallery a').simpleLightbox();
);
</script>
</body>

</html>


Node/Express



const express = require('express');

const app = express();
const port = 5544;

app.use('/scripts', express.static(__dirname + '/node_modules/jquery/dist'));
app.use('/scripts', express.static(__dirname + '/node_modules/simplelightbox/dist'));
app.use('/assets', express.static(__dirname + '/assets'));

app.get('/', (req, res) => res.sendFile(__dirname + '/index.html'));
app.listen(port, () => console.log(`Listening on port $port`));


Assets Folder



assets/
- book.jpg





share|improve this answer

























  • In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

    – Nemanja G
    Mar 7 at 16:01











  • @NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

    – Jacob Heater
    Mar 7 at 16:46











  • I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

    – Nemanja G
    Mar 8 at 9:04















3














This example works fine for me. My setup uses a very basic structure with one image book.jpg, but it works, and the gallery operates as intended. Let me know if you have any questions.



Dependencies



npm install --save simplelightbox



HTML



<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="./scripts/jquery.js"></script>
<script src="./scripts/simple-lightbox.js"></script>
<link href="./scripts/simplelightbox.css" rel="stylesheet" />
</head>

<body>
<div class="gallery">
<a href="./assets/book.jpg">Book 1</a>
<a href="./assets/book.jpg">Book 2</a>
<a href="./assets/book.jpg">Book 3</a>
<a href="./assets/book.jpg">Book 4</a>
</div>

<script>
$(function()
$('.gallery a').simpleLightbox();
);
</script>
</body>

</html>


Node/Express



const express = require('express');

const app = express();
const port = 5544;

app.use('/scripts', express.static(__dirname + '/node_modules/jquery/dist'));
app.use('/scripts', express.static(__dirname + '/node_modules/simplelightbox/dist'));
app.use('/assets', express.static(__dirname + '/assets'));

app.get('/', (req, res) => res.sendFile(__dirname + '/index.html'));
app.listen(port, () => console.log(`Listening on port $port`));


Assets Folder



assets/
- book.jpg





share|improve this answer

























  • In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

    – Nemanja G
    Mar 7 at 16:01











  • @NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

    – Jacob Heater
    Mar 7 at 16:46











  • I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

    – Nemanja G
    Mar 8 at 9:04













3












3








3







This example works fine for me. My setup uses a very basic structure with one image book.jpg, but it works, and the gallery operates as intended. Let me know if you have any questions.



Dependencies



npm install --save simplelightbox



HTML



<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="./scripts/jquery.js"></script>
<script src="./scripts/simple-lightbox.js"></script>
<link href="./scripts/simplelightbox.css" rel="stylesheet" />
</head>

<body>
<div class="gallery">
<a href="./assets/book.jpg">Book 1</a>
<a href="./assets/book.jpg">Book 2</a>
<a href="./assets/book.jpg">Book 3</a>
<a href="./assets/book.jpg">Book 4</a>
</div>

<script>
$(function()
$('.gallery a').simpleLightbox();
);
</script>
</body>

</html>


Node/Express



const express = require('express');

const app = express();
const port = 5544;

app.use('/scripts', express.static(__dirname + '/node_modules/jquery/dist'));
app.use('/scripts', express.static(__dirname + '/node_modules/simplelightbox/dist'));
app.use('/assets', express.static(__dirname + '/assets'));

app.get('/', (req, res) => res.sendFile(__dirname + '/index.html'));
app.listen(port, () => console.log(`Listening on port $port`));


Assets Folder



assets/
- book.jpg





share|improve this answer















This example works fine for me. My setup uses a very basic structure with one image book.jpg, but it works, and the gallery operates as intended. Let me know if you have any questions.



Dependencies



npm install --save simplelightbox



HTML



<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="./scripts/jquery.js"></script>
<script src="./scripts/simple-lightbox.js"></script>
<link href="./scripts/simplelightbox.css" rel="stylesheet" />
</head>

<body>
<div class="gallery">
<a href="./assets/book.jpg">Book 1</a>
<a href="./assets/book.jpg">Book 2</a>
<a href="./assets/book.jpg">Book 3</a>
<a href="./assets/book.jpg">Book 4</a>
</div>

<script>
$(function()
$('.gallery a').simpleLightbox();
);
</script>
</body>

</html>


Node/Express



const express = require('express');

const app = express();
const port = 5544;

app.use('/scripts', express.static(__dirname + '/node_modules/jquery/dist'));
app.use('/scripts', express.static(__dirname + '/node_modules/simplelightbox/dist'));
app.use('/assets', express.static(__dirname + '/assets'));

app.get('/', (req, res) => res.sendFile(__dirname + '/index.html'));
app.listen(port, () => console.log(`Listening on port $port`));


Assets Folder



assets/
- book.jpg






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 15:31

























answered Mar 7 at 15:24









Jacob HeaterJacob Heater

960412




960412












  • In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

    – Nemanja G
    Mar 7 at 16:01











  • @NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

    – Jacob Heater
    Mar 7 at 16:46











  • I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

    – Nemanja G
    Mar 8 at 9:04

















  • In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

    – Nemanja G
    Mar 7 at 16:01











  • @NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

    – Jacob Heater
    Mar 7 at 16:46











  • I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

    – Nemanja G
    Mar 8 at 9:04
















In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

– Nemanja G
Mar 7 at 16:01





In a seperate project, where I just load everything and create html structure = it works fine. But in my project, clicking on an image just opens image as a link, doesnt create the popup like it should.

– Nemanja G
Mar 7 at 16:01













@NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

– Jacob Heater
Mar 7 at 16:46





@NemanjaG I'd need to see more about your project, including html, script usage, etc to be able to help you.

– Jacob Heater
Mar 7 at 16:46













I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

– Nemanja G
Mar 8 at 9:04





I think its an issue with how the project is loading scripts, I just got into it to implement this but probably many other things are messed up. Thanks tho

– Nemanja G
Mar 8 at 9:04



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55046191%2fsimplelightbox-is-not-a-function-jquery%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved