Problem loading js script

Hello,

Someone could help me to resolve this small problem:
I have a codeigniter website and i’am trying to add a pop-up text but it seem the .js won’t load

My php code:

My css code:

 .overlay2.open {
   opacity: 1;
   pointer-events: inherit;
 }
 .overlay2 .mmodal {
   background: white;
   text-align: center;
   padding: 40px 80px;
   box-shadow: 0px 1px 10px rgba(255, 255, 255, 0.35);
   opacity: 0;
   pointer-events: none;
   transition: 0.35s ease-in-out;
   max-height: 100vh;
   overflow-y: auto;
 }
 .overlay2 .mmodal.open {
   opacity: 1;
   pointer-events: inherit;
 }
 .overlay2 .mmodal.open .content2 {
   transform: translate(0, 0px);
   opacity: 1;
 }
 .overlay2 .mmodal .content2 {
   transform: translate(0, -10px);
   opacity: 0;
   transition: 0.35s ease-in-out;
 }
 .overlay2 .mmodal .title {
   margin-top: 0;
 }

And my js script:

 $(".mmodal").each( function(){
 	$(this).wrap('<div class="overlay2"></div>')
 });
 
 $(".open-mmodal").on('click', function(e){
 	e.preventDefault();
 	e.stopImmediatePropagation;
 	
 	var $this = $(this),
 			mmodal = $($this).data("mmodal");
 	
 	$(mmodal).parents(".overlay2").addClass("open");
 	setTimeout( function(){
 		$(mmodal).addClass("open");
 	}, 350);
 	
 	$(document).on('click', function(e){
 		var target = $(e.target);
 		
 		if ($(target).hasClass("overlay2")){
 			$(target).find(".mmodal").each( function(){
 				$(this).removeClass("open");
 			});
 			setTimeout( function(){
 				$(target).removeClass("open");
 			}, 350);
 		}
 		
 	});
 	
 });
 
 $(".close-mmodal").on('click', function(e){
 	e.preventDefault();
 	e.stopImmediatePropagation;
 	
 	var $this = $(this),
 			mmodal = $($this).data("mmodal");
 	
 	$(mmodal).removeClass("open");
 	setTimeout( function(){	
 		$(mmodal).parents(".overlay2").removeClass("open");
 	}, 350);
	
 });	

The result look like this on my website:


Terms of service

This is a

Here is some text and stuff. cool cool

K Bye


Like the js is not loaded

this is loaded:

script src=“assets/js/jquery-3.2.1.min.js”></script

and my js script is also loaded like this:

script src=“assets/js/myscript.js”></script

Even chrome showing the .js loaded in debug mode

Any idea? Thanks you !

I would guess the inclusion is not in the correct place, but I would need to see where you can those tags, and I’ll assume they are just missing pieces from what you copied and pasted over?

Thanks for your answer,

my both .js script are called inside header.php and footer.php
I already include php code inside header.php and footer.php so i know both of them are correctly loaded inside my website. Plus if i inspect the code i can see both of them inside the page.

yes the “< and >” are missing in my first post for my .js script

What do you mean, “called inside”?

https://www.tutorialspoint.com/codeigniter/codeigniter_adding_js_css.htm

Ill check the link now:

For example my: assets/js/footerpopup.js
is write inside views/themes/default/footer.php

The problem with that way, is that the script can be used anywhere, and that path may not be correct being relative.

Ok thanks you ill search in that way

Sponsor our Newsletter | Privacy Policy | Terms of Service