<< Back to New Old Web

by punkedwerewolf
(and a little Javascript too?)

Code Snippets

These are pieces of code I've either built for myself or for other people. Feel free to use them!
Load an image at random from a list on refresh
Click on "rerun" to reload the environment.

See the Pen Load image on random from list. by Sadness (@sadness97) on CodePen.



Notes: Make sure to include the jQuery script in your head tags. Note that you provide the image file names separately from the image path.
Layout with different backgrounds when you scroll

See the Pen Different backgrounds when scrolling by Sadness (@sadness97) on CodePen.

Play a song at random from list on refresh
Click rerun to change the song.

See the Pen Refresh 2 change song by Sadness (@sadness97) on CodePen.



Notes: To make the song autoplay, add the word autoplay to the audio tag in the Javascript. To make the song loop, add the word loop.
Add a transparent pixel border to a div

See the Pen Img border on div by Sadness (@sadness97) on CodePen.

Set HTML5 audio volume with JS

See the Pen Set a volume on autoplay with JS by Sadness (@sadness97) on CodePen.

Use the WebAMP app on your website with a custom theme & songs

See the Pen Put winamp on your page with a custom skin & custom songs! (AND ITS DRAGGABLE) by Sadness (@sadness97) on CodePen.