[SOLVED] Help getting some javascript to work with FW7

Hi, not a FW7 support question, but maybe someone can help :slight_smile:

I have a timer that I want to work with FW7, but I don’t get it to work :frowning:

Works here with jquery:
https://codepen.io/henning-johnsen/pen/LYEyYXQ?editors=0010

Don’t work here without jquery, but with FW7:
https://codepen.io/henning-johnsen/pen/dyPWydJ?editors=0010

Thanks
Henning

if you open the console you will see an error

Uncaught ReferenceError: $ is not defined
at pen.js:92

so this is a jquery issue, not f7.
also you are missing page-content class.

you should read f7 docs carefully

The error $ is not defined is related to $(".c-container") . It’s because you don’t have jQuery installed and jQuery uses $.
Since you have var $$ = Dom7;, use it instead.

Change

$(function () {
var yeah = new Countdown({ minutes: 0, seconds: 10 }, $(".c-container"));
});

to

var yeah = new Countdown({ minutes: 0, seconds: 10 }, $$(".c-container"));

I have updated with page-content class.

Works fine with jquery, not FW7.
I want to use it in FW7.

Thanks for tip. Is now changed to $$

https://codepen.io/henning-johnsen/pen/dyPWydJ?editors=0010

Still same error :frowning:

Maybe there needs more double $ in code?

You’re still using

$(function () {
var yeah = new Countdown({ minutes: 0, seconds: 10 }, $$(".c-container"));
});

It’s the $(function () part that is still breaking it. Remove the function and try using just

var yeah = new Countdown({ minutes: 0, seconds: 10 }, $$(".c-container"));

ahhh… sorry I didn’t read your post well enough…

It works now, thanks :slight_smile: