Category: JavaScript
Add following code to your functions.php
Added variable can be found in i18n
object.
5/3/1 calculator with Angular.js
I have recently started learning Angular.js so I decided to do an weightlifting program calculator as an small exercise. I chose Jim Wendler’s 5/3/1 because it’s the one that I have been using successfully.
Delete node_modules folder on Windows
Sometimes Windows is not able to delete node_modules folder, because file names are larger than is supported by file system. Folder can be deleted with RimRaf, a rm -rf
util for Node.js
Install RimRaf
$ npm install rimraf -g
Remove node_modules folder
$ rimraf node_modules
Using WP Rest API with Angular.js
View demo dev.viklund.fi/wp-rest-api. Full source can be found at Github
Below is a WordPress Rest API 2 filter to add sibling information to posts for easing navigation.
Mouse wheel zoom can be disabled by adding scrollwheel: false
to map options object.
Responsive iframe embeds
Make embedded iframes responsive
CSS:
JavaScript:
Scroll to Element with jQuery
Scroll to element #scrollToElementId
when element #btn
is clicked.
Zoom To Fit All Markers on Google Maps
Zoom Google Maps to fit all markers on your map.
var latLngArr = [new google.maps.LatLng(52.537,-2.061), new google.maps.LatLng(52.564,-2.017)], bounds = new google.maps.LatLngBounds(), idx = 0, count = latLngArr.length; for ( ; idx < count; idx++) { bounds.extend (latLngArr[idx]); } map.fitBounds(bounds);