Tag Archive for jquery

Manually load (Google’s) Latest jQuery in WordPress

<?php wp_deregister_script('jquery'); ?>
<?php wp_head(); ?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

source

Jquery color fade plugin

// Fade from yellow to white
$('p').color_fade();

// Fade from blue to white
$('p').color_fade({from:'blue',to:'white'});

// Fade from black to white, real fast
$('p').color_fade({from'black',to:'white',speed:100});

source

jquery document ready

$(document).ready(function () {
// Code here
});

source

Jquery Accessible Forms Code

$(document).ready(
function()
{
if($.browser.mozilla)
{
$("form.cmxform").find("li > label").not(".nocmx").each(
function(i)
{
span = document.createElement("span");
$(span).css({ display: "block", width: $(this).css("width") });
$(this).css("display","-moz-inline-box");
$(span).html($(this).html());
$(this).html("");
$(this).append(span);
}
);
}
}
);

source

jQuery Translate

<script type='text/javascript'>
$(document).ready(function(){
$.getScript('http://jquery-translate.googlecode.com/files/jquery.translate-1.3.2.min.js', function(){ //when the script is loaded
$.translate(function(){ //when the Google Language API is loaded
$.translate().ui('select', 'option') //generate dropdown

.change(function(){
$('#translateit').translate( 'en', { //revert to english first
not: 'select, pre'
})

.translate( 'en',  $(this).val(), {
not: 'select, pre',
async:  true,
toggle: true,
walk: false
});
})
.val('English') //select English as default
.appendTo('#nav'); //insert the dropdown to the page
});
});
});
</script>

source

Google Hosted jQuery + Document Ready

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
(function($){
$(function(){
// Do stuff...
});
})(this.jQuery);
</script>

source

Volusion with Jquery Body Switcher Script

/*
* 		Body switcher class for Volusion
* 		by Chris J. Lee
* 		2009
*/

$(document).ready(function() {
var loc = $()[0].location.href;
var loc = $()[0].location.href;
var c = loc.length-1; // String Count
if (loc[c] == '/') { $('body').addClass('homepage'); }
else {
$('body').addClass('sub');
}
if (loc.match('default.asp')) $('body').addClass('home');
if (loc.match('-p/') || loc.match('ProductDetails.asp')) $('body').addClass('product');
if (loc.match('-s/')) $('body').addClass('category');
if (loc.match('-a/') || loc.match('article.asp?')) $(body).addClass('article');
if (loc.match('shoppingcart.asp')|| loc.match('one-page-checkout.asp')) $('body').addClass('shoppingcart');
if (loc.match('returns.asp')) $('body').addClass('article return');
if (loc.match('aboutus.asp')) $('body').addClass('article aboutus');
});

source

Latest Jquery

<script src="http://ajax.googleapis.com/ajax/libs/jquery/latest/jquery.js"></script>

source

jQuery Visibility

.is(':visible'))

source

JS External Windows and Poor Man’s E-mail Obfuscate (jQuery)

/*
* Author:		Aaron Alexander (nerdfiles.net)
*/

var baseDomain 		= "test.com";
var baseEmailDomain	= "test.com";

$(document).ready(function(){

/*
Since the "target" attribute is no longer permitted under the XHTML 1.0 Strict specification
See (for a discussion): <a href="http://robertnyman.com/2006/02/13/how-evil-is-the-target-attribute/" >http://robertnyman.com/2006/02/13/how-evil-is-the-target-attribute/</a>
Example: <a href="http://google.com" rel="external">google.com</a>
*/
$("a[rel='external']").addClass("external-link");

$("a[rel='external']").click(function(event) {
window.open(this.href);
event.preventDefault();
});

/*
A poor man's e-mail obfuscation
Checks to see if rel attribute has "email" then grabs the preceding word.
Example: <a href="#" rel="e-mail handle">com.tset@eldnah</a>
*/
$("a[rel^='e-mail']").css({
"unicode-bidi": "bidi-override",
"direction": 	"rtl",
});

$("a[rel^='e-mail']").click(function(event) {
var str = this.rel;
var emailHandle = str.replace(/e-mail /, "");
window.location = "mailto:" + emailHandle + "@" + baseEmailDomain;
event.preventDefault();
});

});

source