Tag Archives: jQuery

jQuery: Change Doctype

There are a few things you might want to know if you’re looking to change the document type (doctype) using jQuery or Javascript. First, doctype is listed as a property in the W3C documentation, and is defined as read-only: interface Document : Node { readonly attribute DocumentType doctype; readonly attribute DOMImplementation implementation; readonly attribute Element documentElement; Element createElement(in DOMString tagName) raises(DOMException); DocumentFragment createDocumentFragment(); While it may be possible to insert a doctype with javascript / jquery above the HTML tag, it is not advisable to do so. Sample code which would do this might look like: <!– no doctype, loads in Quirks Mode (BackCompat) –> <html> <!– rest of the document, then at the end: –> <script> alert(‘now in compatMode ‘+document.compatMode); if (document.compatMode===’BackCompat’) { setTimeout(function() { var markup= document.documentElement.innerHTML; markup= ‘< !DOCTYPE html><html xmlns=”http://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en”>’+markup+’</html>’; document.open(); document.write(markup); document.close(); }, 0); } </script> </html> via

Posted in Tech Tips, Web Development | Tagged , , , , , , | Leave a comment

Use Google Chrome as a Screensaver

You can use Google Chrome‘s –kiosk mode to create a full-screen screensaver of sorts. This might be good if you have a webpage or intranet page you’d like to display. Here’s how I did it for a windows computer: Create a file such as c:\screensaver.bat and add the following code. Replace with your location of chrome.exe @echo off taskkill /im chrome.exe start /wait “” “C:\Documents and Settings\Google\Chrome\Application\chrome.exe” –kiosk http://www.mysite.com rem ## run any command here you’d like after the “screensaver” finishes ## Next, set that to run as a scheduled task after the computer has been idle for 5 minutes (or however long you choose). You can then listen with jQuery / javascript to close the page when the mouse moves. Here is code that closes the page when the mouse moves more than 20 pixels. You could also bind it to a keyboard event. <html> <head> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js”></script> </head> <body> <h1>hello</h1> <div id=”log”></div> <script type=”text/javascript”> var startx = ”; var starty = ”; jQuery(‘html’).bind(‘mousemove’,function(event){ if(startx == ”){ startx = event.pageX; starty = event.pageY; }else { deltax = Math.abs(event.pageX – startx); deltay = Math.abs(event.pageY – starty); var msg = ”; msg += “distance x “; msg += deltax; msg += “distance y “; msg += deltay; $(“#log”).html(“<div>” + msg + “</div>”); if(deltax > 20 || deltay > 20){ closeWindow(); } } }); function closeWindow(){ setTimeout(function(){ window.open(”, ‘_self’, ”); window.close(); },1000); } </script> </body> </html>

Posted in Software, Tech Tips, Web Development | Tagged , , , , , , , , | 3 Comments

WordPress: How to wp_enqueue_script jquery-ui / autocomplete

If you are trying to enqueue jquery’s autocomplete in wordpress, I’d suggest just using the remote version through google’s CDN / API site. You can deregister the jquery-ui with the first line of code, re-register it with the second line of code, and then activate it with the third line of code: wp_deregister_script(‘jquery-ui’); wp_register_script(‘jquery-ui’,'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js’,array(‘jquery’)); wp_enqueue_script(‘jquery-ui’);

Posted in Web Development | Tagged , , , | 3 Comments

googleapis latest jQuery

From JQuery: http://code.jquery.com/jquery-latest.min.js From Google, currently the latest of the 1.x family (1.4) http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

Posted in Web Development | Tagged | Leave a comment

jQueryUI Position – A nice job on visual documentation

I love the documentation provided for jQueryUI’s position

Posted in Design, Web Development | Tagged , | Leave a comment

Fancy Thumbnail Hover Effect w/ jQuery

clipped from www.sohtanaka.com Recently I was checking out some nice flash galleries and came across an effect that I really liked. I had a sudden urge to duplicate that similar effect but using my bread and butter (CSS and jQuery). I thought I’d share this and maybe some of you can find it useful. View Demo

Posted in Design, Web Development | Tagged , | Leave a comment

jQuery speed in firefox vs chrome

so, everyone knows that Chrome is the fastest browser for running Javascript. But it is almost 4x as fast as FF2 for running jQuery UI elements. WOW!

Posted in Web Development | Tagged , , | Leave a comment