Skip to content
  • home
  • portfolio
  • web design journal
  • blog
    • adventure
    • san diego
    • stream
    • projects
    • website design
    • code notes

javascript

Getting Data from Multiple .then Statements in Javascript

September 18, 2023   |   Web Dev

I always have a hard time pulling data through multiple .then statements in javascript. This method works sufficiently well. Basically, define an array/object, and then as data is collected, add content to that array. All of the collected content should be available in the final .then statement. Something like this (all the data is collected […]

Read More

Gulp Minify Javascript

December 8, 2022   |   Web Dev

This will put a copy of the minified js file in the same folder in which it was found. It will require the following: useref, gulpif gulp.task(‘jsminify’, function() {   return gulp.src([     “!node_modules/**/*.js”,     “**/wp-content/themes/**/*.js”,     “!**/**.min.js”   ], { base: “./” })   .pipe(useref())   .pipe(gulpIf(‘*.js’, uglify()))   .pipe(rename({suffix: ‘.min’}))   .pipe(gulp.dest(‘./’)); });

Read More

Javascript Capture Camera on Phone Doesn’t Work on iPhone

June 9, 2022   |   Web Dev

On an iphone you need to add a ‘playsinline’ parameter. I think it works by placing it either in the javascript, or as part of the HTML tag — I just added it to both to be safe, and it resolved the issue so I called it good. In javascript as part of the getUserMedia […]

Read More

Javascript – Show or Hide an Element

May 24, 2022   |   Web Dev

Showing or hiding an element with javascript: (use “#” for elements by ID, or “.” for elements by class) document.querySelector(“#element”).style.display = ‘block’; document.querySelector(“#element”).style.display = ‘none’;

Read More

PHP JSON Returned As Object Instead of Array

May 14, 2016   |   Web Dev

I was returning, what I thought was an array from PHP, but it kept returning it as a json object, so I had something like: $listItem[0][0] = “Jan 1”; $listItem[0][1] = 100; $listItem[1][0] = “Jan 2”; $listItem[1][1] = 120; $listItem[2][0] = “Jan 2”; $listItem[2][1] = 120; …etc… This would return in javascript those an array, […]

Read More

A Simple Slideout Menu

December 18, 2015   |   Web Dev

I just wanted an easy slideout menu.  Click on a link, and the menu slides out from the left side of the screen.  Click on the link again, or somewhere else on the page, and the menu slides back in.  Here it is: HTML Code data-openwidth is the width in pixels of however wide you […]

Read More

Enhancements for jPlayer Implementation

October 5, 2015   |   Web Dev

I love the jPlayer for easily being able to add modern mp3 support to web pages.  I wanted a few additional features, so I created this additional script which adds a few updated features: Adding rewind/fast-forward support Ability to toggle the volume controls on and off Ability to specify the mp3 url by setting a […]

Read More

Preserving Click Events With jQuery UI

August 30, 2015   |   Web Dev

My click events weren\’t being preserved when using the jquery sortable functionality.  After dragging a list item around, elements like my checkboxes would no longer work, and not just for the element that was being dragged, but for any of the checkboxes in the entire list.  It took a bit of searching, but to get […]

Read More

Javascript define a variable if it isn’t defined currently

June 27, 2015   |   Web Dev

It seems like this comes up quite a bit.  This will create a new variable if the variable isn\’t currently defined: var myVariable = myVariable || “”; Or to define it as an array: var myVariable = myVariable || {};

Read More

Handlebars Just Adds Bloat and Complication

May 21, 2015   |   Web Dev

I kind of like Handlebars for templating, but more and more, I think it’s just makes the codebase more bloated and complicated: My problems with handlebars: 1. I can’t just use my existing javascript code. For instance, I have an existing function to format a phone number, but to use this within a handlebars template,  […]

Read More

Posts navigation

Older posts

drempd | san diego, ca


home contact

adventures san diego projects stream website design

portfolio resume san diego web design freelance web designer

custom web design responsive web design website maintenance