I am new user in github…
I try to upload project that contain html , css , js files … and the js file does not work …?!
my code :
Hello and welcome to the FCC community~!
What do you mean by “the js file does not work”? What are you expecting it to be doing?
just little code to control navbar
$(function () {
menu = $(“nav ul”);
$("#openup").on(“click”, function (e) {
e.preventDefault();
menu.slideToggle();
});
$(window).resize(function () {
var w = $(this).width();
if (w > 580 && menu.is(":hidden")) {
menu.removeAttr("style");
}
});
$(“nav li”).on(“click”, function (e) {
var w = $(window).width();
if (w < 580) {
menu.slideToggle();
}
});
(".open-menu").height((window).height());
});
when i use mobile mode it should be work , but it does not , but in my local machine it works normally
just little code to control navbar
$(function () {
menu = $(“nav ul”);
$("#openup").on(“click”, function (e) {
e.preventDefault();
menu.slideToggle();
});
$(window).resize(function () {
var w = $(this).width();
if (w > 580 && menu.is(":hidden")) {
menu.removeAttr("style");
}
});
$(“nav li”).on(“click”, function (e) {
var w = $(window).width();
if (w < 580) {
menu.slideToggle();
}
});
(".open-menu").height((window).height());
});
Are you hosting this on GitHub pages? I’m confused by what you are asking here.
i upload project in github, this project locally works , and javascript part work very well, when i upload it in github the javascript part does not work although i checked every thing…
Just uploading the files to GitHub will not do anything to “make them work” - you need a live version of the project hosted somewhere.
Ah~ You’re using jQuery, and serving the jQuery over
http
but serving your site over https
. It’s automatically blocking the jQuery from loading, which throws errors in your JS file and shuts it down.
thanks for your help , i appreciate your effort , i will try to fix it and it will work ISA , thanks again
it works <3 thanks again <3
Glad I could help! Happy coding!