Click here to Skip to main content
16,020,313 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Total Recall? nope Pin
Ron Anders29-Jul-24 5:02
Ron Anders29-Jul-24 5:02 
GeneralRe: Total Recall? nope Pin
Daniel Pfeffer30-Jul-24 12:35
professionalDaniel Pfeffer30-Jul-24 12:35 
GeneralRe: Total Recall? nope Pin
RickZeeland30-Jul-24 18:36
mveRickZeeland30-Jul-24 18:36 
GeneralRe: Total Recall? nope Pin
Nelek30-Jul-24 22:29
protectorNelek30-Jul-24 22:29 
GeneralWhen a UI designer chooses to use a numeric up/down when a checkbox would make more sense Pin
PIEBALDconsult28-Jul-24 17:10
mvePIEBALDconsult28-Jul-24 17:10 
GeneralRe: When a UI designer chooses to use a numeric up/down when a checkbox would make more sense Pin
RickZeeland28-Jul-24 21:12
mveRickZeeland28-Jul-24 21:12 
GeneralRe: When a UI designer chooses to use a numeric up/down when a checkbox would make more sense Pin
Mike Hankey29-Aug-24 4:34
mveMike Hankey29-Aug-24 4:34 
GeneralCSS & Sophocles, more related than you know Pin
raddevus22-Jul-24 12:22
mvaraddevus22-Jul-24 12:22 
While working on a SPA I had some CSS that I was applying on the click of a button.
When the button was clicked, it would make one or the other DIVs go fullscreen (except for a small portion at the top where the nav bar was).

Imagine you have these two divs -- one yellow and one cyan;
CSS
#first{
  background: yellow;
}

#second{
  background: cyan;
}
Then when you click a button in the navbar it would make one or the other go fullscreen by applying a fullscreen CSS class.
It worked great & I was very happy with the simplicity of it all.
If you really want to see it work (toggle), take a look at this simple jsfiddle[^].
CSS
.fullScreen{
  width: 100%;
  height: 90%;
  z-index: 20;
  position: absolute;
  top: 12%;
  padding: 10pt;
}
Here's the button click code.
JavaScript
// select the div and add the style
document.querySelector("#first").classList.add("fullScreen");
// remove style from other div so it isn't fullscreen
document.querySelector("#second").classList.remove("fullScreen");
// vice versa for the other div -- not showing all the toggle code
It Worked, Then Didn't!
It was all working. I copied the code to another project and had it all set up.
But suddenly clicking the button wouldn't do the fullscreen. I tried all manner of things.
Was the button click working? I added an alert() and saw the button was working.
I was going out of my bleedin' mind.
Then I looked real hard at the styles that I had copied to the new project.
Can You See It?
Do you see the problem?

CSS
#first{
  background: yellow;
}

#second{
  background: cyan;
};

.fullScreen{
  width: 100%;
  height: 90%;
  z-index: 20;
  position: absolute;
  top: 12%;
  padding: 10pt;
}

Oy!! I have only myself to blame.
As Sophocles said:
The keenest sorrow is to recognize ourselves as the sole cause of all our adversities.

Sophocles was obviously a software developer.
GeneralRe: CSS & Sophocles, more related than you know Pin
Jeremy Falcon22-Jul-24 14:19
professionalJeremy Falcon22-Jul-24 14:19 
GeneralRe: CSS & Sophocles, more related than you know Pin
raddevus23-Jul-24 2:44
mvaraddevus23-Jul-24 2:44 
GeneralRe: CSS & Sophocles, more related than you know Pin
Jeremy Falcon23-Jul-24 6:47
professionalJeremy Falcon23-Jul-24 6:47 
GeneralRe: CSS & Sophocles, more related than you know Pin
Jeremy Falcon23-Jul-24 7:02
professionalJeremy Falcon23-Jul-24 7:02 
GeneralRe: CSS & Sophocles, more related than you know Pin
raddevus23-Jul-24 7:16
mvaraddevus23-Jul-24 7:16 
GeneralRe: CSS & Sophocles, more related than you know Pin
Jeremy Falcon23-Jul-24 9:13
professionalJeremy Falcon23-Jul-24 9:13 
GeneralRe: CSS & Sophocles, more related than you know Pin
RickZeeland22-Jul-24 19:13
mveRickZeeland22-Jul-24 19:13 
AnswerRe: CSS & Sophocles, more related than you know Pin
raddevus23-Jul-24 2:43
mvaraddevus23-Jul-24 2:43 
GeneralRe: CSS & Sophocles, more related than you know Pin
Jeremy Falcon23-Jul-24 6:50
professionalJeremy Falcon23-Jul-24 6:50 
JokeRe: CSS & Sophocles, more related than you know Pin
Peter_in_278022-Jul-24 20:27
professionalPeter_in_278022-Jul-24 20:27 
GeneralRe: CSS & Sophocles, more related than you know Pin
TNCaver23-Jul-24 10:22
TNCaver23-Jul-24 10:22 
GeneralRe: CSS & Sophocles, more related than you know Pin
Richard Deeming23-Jul-24 21:25
mveRichard Deeming23-Jul-24 21:25 
GeneralRe: CSS & Sophocles, more related than you know Pin
TNCaver24-Jul-24 4:09
TNCaver24-Jul-24 4:09 
GeneralLinux C PreProcessor: Who Knew? Pin
raddevus4-Jul-24 6:26
mvaraddevus4-Jul-24 6:26 
GeneralRe: Linux C PreProcessor: Who Knew? Pin
trønderen4-Jul-24 8:22
trønderen4-Jul-24 8:22 
GeneralRe: Linux C PreProcessor: Who Knew? Pin
Jalapeno Bob4-Jul-24 9:46
professionalJalapeno Bob4-Jul-24 9:46 
GeneralRe: Linux C PreProcessor: Who Knew? Pin
raddevus4-Jul-24 10:14
mvaraddevus4-Jul-24 10:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.