pheidole Posted November 1, 2018 Share Posted November 1, 2018 (edited) Nothing happens when i click on it.... Not sure why... Could it be XAMMP? Im running the latest version and do not have access to a live server to test. Thanks ///////////////////////////////////////////////////////////////////////////////////////////////////////////// <!DOCTYPE html> <html> <head> <title></title> <style> .hover_bkgr_fricc{ background:rgba(0,0,0,.4); cursor:pointer; display:none; height:100%; position:fixed; text-align:center; top:0; width:100%; z-index:10000; } .hover_bkgr_fricc .helper{ display:inline-block; height:100%; vertical-align:middle; } .hover_bkgr_fricc > div { background-color: #fff; box-shadow: 10px 10px 60px #555; display: inline-block; height: auto; max-width: 551px; min-height: 100px; vertical-align: middle; width: 60%; position: relative; border-radius: 8px; padding: 15px 5%; } .popupCloseButton { background-color: #fff; border: 3px solid #999; border-radius: 50px; cursor: pointer; display: inline-block; font-family: arial; font-weight: bold; position: absolute; top: -20px; right: -20px; font-size: 25px; line-height: 30px; width: 30px; height: 30px; text-align: center; } .popupCloseButton:hover { background-color: #ccc; } .trigger_popup_fricc { cursor: pointer; font-size: 20px; margin: 20px; display: inline-block; font-weight: bold; } </style> </head> <body> <script src="pop.js"></script> <a class="trigger_popup_fricc">popup</a> <div class="hover_bkgr_fricc"> <span class="helper"></span> <div> <div class="popupCloseButton">X</div> <p>adding latert<br />blah!</p> </div> </div> </body> </html> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// IN THE POP FILE SAVED IN THE SAME DIRECTORY $(window).load(function () { $(".trigger_popup_fricc").click(function(){ $('.hover_bkgr_fricc').show(); }); $('.hover_bkgr_fricc').click(function(){ $('.hover_bkgr_fricc').hide(); }); $('.popupCloseButton').click(function(){ $('.hover_bkgr_fricc').hide(); }); }); Edited November 1, 2018 by pheidole Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/ Share on other sites More sharing options...
cyberRobot Posted November 1, 2018 Share Posted November 1, 2018 What browser do you use? Are you familiar with using your browser's developer console? If so, are you getting a JavaScript error? Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561893 Share on other sites More sharing options...
pheidole Posted November 1, 2018 Author Share Posted November 1, 2018 (edited) latest version of mozilla ... Works in my browser when used here https://html-online.com/articles/simple-popup-box/ Using the same browser in localhost. Im guessing it has to do with XAMMP ? Edited November 1, 2018 by pheidole Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561894 Share on other sites More sharing options...
cyberRobot Posted November 1, 2018 Share Posted November 1, 2018 (edited) I'm guessing you mean Firefox, which is a Mozilla-based browser. Assuming that's correct, have you used Firefox's Web Console before? More information about accessing the console can be found here:https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console In the console, are you getting any JavaScript errors? Edited November 1, 2018 by cyberRobot fixed typo Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561895 Share on other sites More sharing options...
cyberRobot Posted November 1, 2018 Share Posted November 1, 2018 By the way, I didn't see anything in the code above. Does your real code import the necessary code so that you can use jQuery? If not, your browser's developer console probably says something like "Uncaught ReferenceError: $ is not defined". Note that you can import the library from Google (https://developers.google.com/speed/libraries/). Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561896 Share on other sites More sharing options...
pheidole Posted November 1, 2018 Author Share Posted November 1, 2018 (edited) yeah, its firefox i don't think Mozilla makes any other browsers do they? i have developer tools installed, no errors i just put the Javascript and css into the same file... It should run, but.... If you wish you can toss i into a file and give it a go and see if it works for you.. i think imma move on and concede defeat and try my secondary plan. I really was wanting to keep js off my site anyhow <!DOCTYPE html> <html> <head> <title></title> <script> .hover_bkgr_fricc{ background:rgba(0,0,0,.4); cursor:pointer; display:none; height:100%; position:fixed; text-align:center; top:0; width:100%; z-index:10000; } .hover_bkgr_fricc .helper{ display:inline-block; height:100%; vertical-align:middle; } .hover_bkgr_fricc > div { background-color: #fff; box-shadow: 10px 10px 60px #555; display: inline-block; height: auto; max-width: 551px; min-height: 100px; vertical-align: middle; width: 60%; position: relative; border-radius: 8px; padding: 15px 5%; } .popupCloseButton { background-color: #fff; border: 3px solid #999; border-radius: 50px; cursor: pointer; display: inline-block; font-family: arial; font-weight: bold; position: absolute; top: -20px; right: -20px; font-size: 25px; line-height: 30px; width: 30px; height: 30px; text-align: center; } .popupCloseButton:hover { background-color: #ccc; } .trigger_popup_fricc { cursor: pointer; font-size: 20px; margin: 20px; display: inline-block; font-weight: bold; } </style> </head> <body> <sript> $(window).load(function () { $(".trigger_popup_fricc").click(function(){ $('.hover_bkgr_fricc').show(); }); $('.hover_bkgr_fricc').click(function(){ $('.hover_bkgr_fricc').hide(); }); $('.popupCloseButton').click(function(){ $('.hover_bkgr_fricc').hide(); }); }); </script> <a class="trigger_popup_fricc">popup</a> <div class="hover_bkgr_fricc"> <span class="helper"></span> <div> <div class="popupCloseButton">X</div> <p>adding latert<br />blah!</p> </div> </div> </body> </html> Edited November 1, 2018 by cyberRobot fixed <script> tag and added code tags Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561897 Share on other sites More sharing options...
cyberRobot Posted November 1, 2018 Share Posted November 1, 2018 Your code works for me when I import the jQuery library. Basically, I added the following line above your <script> tag: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> For some reason, I also needed to change the following: $(window).load(function() { To this $(document).ready(function() { The popup seems to open and close now. 1 Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561899 Share on other sites More sharing options...
pheidole Posted November 1, 2018 Author Share Posted November 1, 2018 I did your modifications and it worked perfectly. Thanks CyberR Quote Link to comment https://forums.phpfreaks.com/topic/307848-not-working-and-it-should/#findComment-1561900 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.