@@codewithbubb I'm quite far in, I think I know a lot about javascript but it's putting it all together, everything you did in the video I knew but applying is something I need to practice more.
Hi Stefan, sure if you have some way of knowing whether a user is a guest or not (you can store it in a cookie / local storage) then you could trigger the modal when that condition is true.
Hi Ankit, thanks for the suggestion! I actually use Angular 6/7 quite a lot in my day job. Trouble is, there is a new version release every 6 months so video tutorials become outdated very quickly! I did think about doing some live training on it though - would you be interested if I were to schedule a UA-cam live series on Angular?
Hi Shaz, sure you could just add event listeners to any button you want to trigger it on. With this example if you wanted to customise the modal for different buttons you would need to create separate modals for each button (that is different).
Hi@@codewithbubb I've tried everything. The buttons only get triggered if they are on the same page as the modal and if the buttons are on a different page to the modal it doesn't work. Please take a look at my code below and see if I'm doing something wrong. Thanks: var userSelection = document.getElementsByClassName('button'); var modal = document.getElementById('modal-wrapper'); for (var i = 0; i < userSelection.length; i++) { userSelection[i].addEventListener("click", function() { modal.style.display = 'block'; }); }
You mean call the modal at the end of some sort of event / automatically? Just call the code that's inside the event listener for the click event whenever you want the modal to trigger. Hope that helps?
Video is great but does anyone know how to link the JS and the HTML, I tried a normal way to link the pages but I guess it needs a function and I do not know enough to figure out how to modify it
Hi John, yes that's right i'm running parcel as a build tool which automatically compiles Sass in the project. I'm not using many features of Sass here, just the nesting really.
Thanks im kinda struggling on the classlist.toggle Because i cant over ride the property For example modal{ Position:absolute; Left: -500px; &--move{ Left: 0px; } When i tried to toggle the class via javascript, and it cant override the property and i dont want to use !important, It doesnt work Is there a thing i dont get here? I hope you could help me out
@@codewithbubb Okay i think I've notice the problem, I've just forgot to put the function inside the event listener, Sometimes you really need a 15 to an hour break just to notice the problem. Thanks for the replies though it really helps a lot ^_^ I hope we can see more content such as this or sample projects with Basic HTML,CSS and javascript.
@@johnbenjaminmercado7320 Ah, glad you got it figured out. Yes, sometimes a break can do wonders! Sure, I was planning on doing a series of converting PSD website designs to HTML/CSS if that would be of interest to you?
bruh i keep trying this but i always get the error "uncaught TypeError: document.querySelector(...) is null". and i keep getting this error with every tutorial I use on modal popups!! pls help
You can see how the simple template that is the base to this project was made here: ua-cam.com/video/zPe5R2qz_Ok/v-deo.html
This was the most concise tutorial on modals I could find on UA-cam. Thank you for the great info.!
Cheers! I try to cut out the waffle and get to the point.
Dude you're the GOAT. Thank you!!!
Cheers!
God Bless You! And may the Force be with you!
Very good James, keep them coming and I will keep watching and learning.
Thanks Chris! Sure, will do. Where are you in your web development journey?
@@codewithbubb I'm quite far in, I think I know a lot about javascript but it's putting it all together, everything you did in the video I knew but applying is something I need to practice more.
Yeah, I hear you - just keep practising and it'll get easier over time :)
Video is very helpful, thank you for sharing it.
You're welcome! Glad you found it useful 😀
You all explaining all of this versus reading at the library...so helpful
Glad you are finding it useful Edd 😀
hi, great video thanks for this. how to make modal box appear only on homepage load?
this was so helpful! Thank you :)
Hi! How do you create a modal whenever it is hovered in an area from an image map? I hope you can help me :( thank you so much
WOW! can i make the popup only appear when a specific user clicks on it, e.g. guest?
Hi Stefan, sure if you have some way of knowing whether a user is a guest or not (you can store it in a cookie / local storage) then you could trigger the modal when that condition is true.
Can you prepare a video series on angular 6or7
Hi Ankit, thanks for the suggestion! I actually use Angular 6/7 quite a lot in my day job. Trouble is, there is a new version release every 6 months so video tutorials become outdated very quickly!
I did think about doing some live training on it though - would you be interested if I were to schedule a UA-cam live series on Angular?
So great and easy you make it man. What is the name of this program? Thanks for the video 👊
Codepen
Hi can you please tell me how I can reuse this modal across different pages e.g. all the login buttons on different pages?
Hi Shaz, sure you could just add event listeners to any button you want to trigger it on. With this example if you wanted to customise the modal for different buttons you would need to create separate modals for each button (that is different).
Hi@@codewithbubb I've tried everything. The buttons only get triggered if they are on the same page as the modal and if the buttons are on a different page to the modal it doesn't work. Please take a look at my code below and see if I'm doing something wrong. Thanks:
var userSelection = document.getElementsByClassName('button');
var modal = document.getElementById('modal-wrapper');
for (var i = 0; i < userSelection.length; i++) {
userSelection[i].addEventListener("click", function() {
modal.style.display = 'block';
});
}
Hy
I want to show without clicking "Show Popup" Botton how I can do that?
Please must reply!!
You mean call the modal at the end of some sort of event / automatically? Just call the code that's inside the event listener for the click event whenever you want the modal to trigger.
Hope that helps?
Video is great but does anyone know how to link the JS and the HTML, I tried a normal way to link the pages but I guess it needs a function and I do not know enough to figure out how to modify it
Are you using Sass on this video? I hope i got some reply :(
Hi John, yes that's right i'm running parcel as a build tool which automatically compiles Sass in the project. I'm not using many features of Sass here, just the nesting really.
Thanks im kinda struggling on the classlist.toggle
Because i cant over ride the property
For example
modal{
Position:absolute;
Left: -500px;
&--move{
Left: 0px;
}
When i tried to toggle the class via javascript, and it cant override the property and i dont want to use !important,
It doesnt work
Is there a thing i dont get here? I hope you could help me out
Are you doing this in Codepen? Can you share your code?
@@codewithbubb Okay i think I've notice the problem, I've just forgot to put the function inside the event listener, Sometimes you really need a 15 to an hour break just to notice the problem. Thanks for the replies though it really helps a lot ^_^ I hope we can see more content such as this or sample projects with Basic HTML,CSS and javascript.
@@johnbenjaminmercado7320 Ah, glad you got it figured out. Yes, sometimes a break can do wonders! Sure, I was planning on doing a series of converting PSD website designs to HTML/CSS if that would be of interest to you?
unfortunately your examples are broken at link Completed project
Thanks for that! I've just taken a look and updated it.
bruh i keep trying this but i always get the error "uncaught TypeError: document.querySelector(...) is null". and i keep getting this error with every tutorial I use on modal popups!! pls help
anyone knows what the name of the text editor that he"s using ?
Hi, it's Codepen - codepen.io/
appriciate it bro (y)
You're welcome 😀
bien pero lo que se quiere es que la ventana aparesca ni bien abres la pagina web.. sin apretar ningun enlace..porfvr