• Advertisement

Kristian Gorenc

Member
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Kristian Gorenc

  • Rank
    Newbie
  1. Different div/lightbox for different time of day

    I've found another way to create a simple lightbox/colored area. But still can't combine all together. So... For Lightbox I have this: [CODE] <style> .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80); } </style> <body onload="document.getElementById('fade').style.display='block'"> <div id="fade" class="black_overlay"></div> </body> [/CODE] And for time determination I found this (example time inputed): [CODE] <script type="text/javascript"> onload=function(){ var rightNow = new Date(); var hour = rightNow.getHours(); var newDisplay = 'none'; // unless we see otherwise if((hour>= 1) && (hour<= 5)) { newDisplay = 'block'; } } document.getElementById('fade').style.display=newDisplay"</script> [/CODE] I can't seem to connect those two to work like I want :/ Help is greatly appreciated!
  2. Different div/lightbox for different time of day

    Thanks for the answer! Yes, I called the script in the body onload, but my problem is that I don't know how to "connect" the script for lightbox and the time of day part. My idea to determine the time of day is following: [CODE] <SCRIPT type="text/javascript"> day = new Date() hour = day.getHours() if ((hour == 8) || (hour == 9) || (hour == 10) || (hour == 11) || (hour == 12) || (hour == 13) || (hour == 14) || (hour == 15) || (hour == 16)) { // Show the red <div> }; if ((hour == 17) || (hour == 18)) {// show the green <div> and "else - show no div }; </SCRIPT> [/CODE] How can I incorporate the time determination in the light box script which I published in my first post? @Telastyn: I doubt the situation will come so that I would need this - onload is good enough. thanks!
  3. Hello guys! I've been trying to do the following: If the time of day is between 8:30 and 17:00, the whole page is covered by red "lightbox" div. If time is between 17:00 and 18:00 the page is covered by green lightbox div. For other times there is no lightbox effect (div is not "active"). Optionaly one could "disable" the div (be it red or green) by pushing a button. Till now I've tried several different approaches but with none of them I could "start" the div. For lightbox I used this script: [CODE] <script type="text/javascript"><!-- // Content Box (Lightbox) Over Shaded Web Page // Version 1.0a // September 24, 2009 // Copyright 2009 Bontrager Connection, LLC var IEmax = 2000; var IE = (navigator.userAgent.indexOf('MSIE') != -1) ? true : false; var xDialogBoxPosition = 0; var yDialogBoxPosition = 0; var ViewportHeight = 0; var RealLength = 0; var PageWidth = 0; var PageHeight = 0; var ShadowDiv; var DialogDiv; function GetViewportDimensions() { var viewX = 0; var viewY = 0; if(self.innerWidth) { viewX=self.innerWidth; viewY=self.innerHeight; } else if(document.documentElement&&document.documentElement.clientWidth) { viewX=document.documentElement.clientWidth; viewY=document.documentElement.clientHeight; } else if(document.body) { viewX=document.body.clientWidth; viewY=document.body.clientHeight; } return Array(viewX,viewY); } // function GetViewportDimensions() function GetPageDimensions() { var pageX = 0; var pageY = 0; if(window.innerHeight && window.scrollMaxY) { pageX = window.innerWidth + window.scrollMaxX; pageY = window.innerHeight + window.scrollMaxY; } else if(document.body.scrollHeight > document.body.offsetHeight) { pageX = document.body.scrollWidth; pageY = document.body.scrollHeight; } else if(document.body.scrollWidth && document.body.scrollHeight) { pageX = document.body.scrollWidth; pageY = document.body.scrollHeight; } else { pageX = document.body.offsetWidth; pageY = document.body.offsetHeight; } var viewDimensions = GetViewportDimensions(); if(pageX < viewDimensions[0]) { pageX = viewDimensions[0]; } if(pageY < viewDimensions[1]) { pageY = viewDimensions[1]; } else if(IE) { pageY += 25; RealLength = pageY; ViewportHeight = viewDimensions[1]; if(pageY > IEmax) { pageY = IEmax; } } return Array(pageX,pageY); } // function GetPageDimensions() function ShadeTheWindow(shadow) { var pageDimensions = GetPageDimensions(); PageWidth = pageDimensions[0]; PageHeight = pageDimensions[1]; ShadowDiv = document.getElementById(shadow); ShadowDiv.style.width = PageWidth + "px"; ShadowDiv.style.height = PageHeight + "px"; ShadowDiv.style.display = "block"; } // function ShadeTheWindow(); function PositionDialogDiv() { var xScrollPosition = window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft; var yScrollPosition = window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop; if(IE && PageHeight == IEmax) { var shadowpos = ( yScrollPosition < (IEmax - ViewportHeight) ) ? 0 : yScrollPosition - 1; if( (shadowpos + PageHeight) > RealLength ) { shadowpos = RealLength - IEmax; } ShadowDiv.style.top = shadowpos + "px"; } DialogDiv.style.left = xDialogBoxPosition + xScrollPosition + "px"; DialogDiv.style.top = yDialogBoxPosition + yScrollPosition + "px"; } // function PositionDialogDiv() function DisplayDialogDiv(dialog) { DialogDiv = document.getElementById(dialog); if(xDialogBoxPosition == 0 && yDialogBoxPosition == 0) { xDialogBoxPosition = parseInt(DialogDiv.style.left); yDialogBoxPosition = parseInt(DialogDiv.style.top); } PositionDialogDiv(); DialogDiv.style.display = "block"; window.onscroll = PositionDialogDiv; } // function DisplayDialogDiv() function PresentDialogDiv(shadow,dialog) { ShadeTheWindow(shadow); DisplayDialogDiv(dialog); } // function PresentDialogDiv() function RemoveDialogDiv() { DialogDiv.style.display = "none"; ShadowDiv.style.display = "none"; } // function RemoveDialogDiv() //--></script> [/CODE] and Div's [CODE] <div id="shadeDivID_red" style=" display:none; z-index:100499; position:absolute; left:0px; top:0px; width:100%; height:100%; margin:0; padding:0; border:none; opacity:0.4; filter:alpha(opacity=40); background-color:#FD0006; "> </div> <div id="shadeDivID_green" style=" display:none; z-index:100499; position:absolute; left:0px; top:0px; width:100%; height:100%; margin:0; padding:0; border:none; opacity:0.4; filter:alpha(opacity=40); background-color:#0F0; "> </div> [/CODE] But I don't know how to execute this lightbox divs according to the times written above. Or how to "kill" the lightbox with a push of a button. Thanks for helping a noob [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img])
  4. Change CSS for included files

    [quote name='Antheus' timestamp='1329661039' post='4914502'] [quote]The data in my txt file is organized so one word is in each row. When included (because it's raw data) the parsed result is that all words are in one row. How can I put the output in my "new page" (with txt included) so it's one word in each row?[/quote] Some formatting needs to be applied to the txt file. Ideally, it would be formatted as <ul> to preserve semantic meaning. Depending on where the txt comes from, it might be simpler to modify that or modify whatever generates it. [/quote] What if it's hard to modify the source that generates the txt file? Is there a way to format the output with CSS? Thanks!
  5. Hello! I'm not a skilled web-programmer (as it's obvious from the question [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]). My problem is the following: I have a "New Page" into which I included two files (with PHP include function). One of them is [u]html[/u] and one of them is [u]txt[/u]. The page into which I included the two files has different design than the html document included, so I want to change the CSS of the included part on my new page. The result would be that included html file on its own has it's own CSS design and on the "new page" into which the html is included it has different design. Huh, I hope I didn't complicate to much [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Another question related to the included txt file: The data in my txt file is organized so one word is in each row. When included (because it's raw data) the parsed result is that all words are in one row. How can I put the output in my "new page" (with txt included) so it's one word in each row? Thanks a bunch!
  • Advertisement