Tag: jquery

Chrome Zoom Shifts Layout

Problem: When zooming in or out on Chrome, the widths of elements increases very slightly and causes some elements to shift to the next line. Solution: The actual problem is Chrome adjusts the widths of elements by tenths.  So something

Posted in Coding Tagged with: ,

Escape strings for use in JavaScript

When using parameters from the URL, it should always be sanitized before using it in your javascript. Using jQuery you can easily do: var safeString = $(“<span></span>”).text(unsafeString).html(); Using plain javascript: var entityMap = { “&”: “&amp;”, “<“: “&lt;”, “>”: “&gt;”,

Posted in Coding Tagged with: , ,

Bootstrap Tab linking

If you use Bootstrap (v3.x) you would see that clicking on a tab does add anything to the url so if you were to refresh, you wouldn’t go back to the tab you are on.  The post below says to

Posted in Coding Tagged with: , ,

Google CDN

A lot of scripts and even styles can be retrieved from google’s cdn.  Save yourself some time, save your server some time, and save your visitors some time. jQuery UI themes: http://stackoverflow.com/questions/820412/downloading-jquery-css-from-googles-cdn Scripts in WordPress: Use the Use Google Libraries

Posted in Coding, Off the Shelf Tagged with: ,

Fancybox not working after second click

Problem Setting up fancybox 1.3.4 with inline content doesn’t work when clicking on the link twice. Solution The problem I think is with the upgraded version of jQuery.  If using jQuery 1.4 like the example, it should work fine.  But

Posted in Coding Tagged with: ,

Fancybox and Datepicker Error

Problem Using fancybox and datepicker I got an “a is undefined” javascript error.  I added datepicker to the fancybox by using the following code:   This caused the datepicker to show up correctly, but when selecting a date it closed

Posted in Coding Tagged with:

WordPress 3.6 update caveats

The main problem in updating WordPress is the version of jQuery that is used is also updated.  jQuery is updated from version 1.8.3 to version 1.10.2.   Below is a record of what I’v gone through.  It’ll grow as I

Posted in Coding Tagged with: ,

IE Doesn’t see padding on hover

Problem Internet Explorer 8 (I no longer even look at IE 7) seems to not be able to see the padding on an anchor tag within a ul > li > a structure.   Using jQuery I have a hover

Posted in Coding Tagged with: , , ,

jQuery – When to use return false or preventDefault

Ran into a great article that explains the differences between return false, preventDefault and stopPropagation.  Here’s a summary: return false does both preventDefault and stopProgagation preventDefault just stops the browser default event. stopPropagation stops bubbling. In most cases you would

Posted in Coding Tagged with: ,

Fade in, fade out not smooth in jQuery

Problem: I had a large banner with multiple layers and animation going on.  I was trying to fade out a 1000px+ by 400px or so image along with other moving objects.  In addition to that the image had some transparency

Posted in Coding Tagged with: