Search result for 'jquery function enqueue'
(0.0312881469727 seconds)
132 pages : 1 2 3 4 5 6 7 8 9 10 11 Next › Last»

oriontimbers/WordPress Enqueue Scripts - jQuery ( PHP)

<?php 
	function my_init_method() {
		if( !is_admin() ) {
			wp_enqueue_script( 'jquery' );
		}
	}
	add_action('init', 'my_init_method');
?>

Snippet for adding to your functions.php file to enqueue jQuery.

sridhar/Enqueue Javascript ( PHP)

// Code in functions.php:

function my_theme_scripts() {
  
  if ( !is_admin() ) { // instruction to only load if it is not the admin area
   // register your script location, dependencies and version
   wp_deregister_script( 'jquery' );
   wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js');
   wp_enqueue_script( 'jquery' );
   
   wp_register_script('custom_script',
       get_bloginfo('stylesheet_directory') . '/js/expand_collapse.js',
       array('jquery'),
       '1.0' );
   // enqueue the script
   wp_enqueue_script('custom_script');
}
}   
 
add_action('init', 'my_theme_scripts');

// /js/expand_collapse.js in child theme:

<script type="text/javascript">
        jQuery(document).ready(function($) {
            $('#upNav').hide();
			
			$('#showBtn').click(function() {
  				$('#upNav').toggle();
			});
			
			$('#parent').hover(function() {
  				$('#upNav').show();
			});
			
			$('#parentNav').mouseleave(function() {
  				$('#upNav').hide();
			});
        });
        </script>

zac/Enqueue again ( PHP)

add_filter('the_posts', 'conditionally_add_scripts_and_styles'); // the_posts gets triggered before wp_head
function conditionally_add_scripts_and_styles($posts){
	if (empty($posts)) return $posts;
 
	$shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued
	foreach ($posts as $post) {
		if (stripos($post->post_content, '[code]')) {
			$shortcode_found = true; // bingo!
			break;
		}
	}
 
	if ($shortcode_found) {
		// enqueue here
		wp_enqueue_style('my-style', '/style.css');
		wp_enqueue_script('my-script', '/script.js');
	}
 
	return $posts;
}

This simple function fires before the header gets printed, as it's attached to the 'the_posts' hook. However, this time it has full access to the posts' content.

Trinovantes/Enqueue jQuery ( PHP)

if (!is_admin()){
    wp_deregister_script('jquery');
    wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false);
    wp_enqueue_script('jquery');
}



adambundy/WordPress Enqueue jQuery - Google CDN ( PHP)

------------------------------------------------

This must be inserted into the functions.php file:

function modify_jquery() {
	if (!is_admin()) {
		// comment out the next two lines to load the local copy of jQuery
		wp_deregister_script('jquery');
		wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js', false, '1.6.1');
		wp_enqueue_script('jquery');
	}
}
add_action('init', 'modify_jquery');

------------------------------------------------

This must be inserted into the header.php file (BEFORE WP_HEAD CALL!):

<?php wp_enqueue_script("jquery"); ?>

------------------------------------------------

jQuery functions should be wrapped in this so that $ operator represents no-conflict (BELOW WP_HEAD):

<script type='text/javascript'>
jQuery(document).ready(function($) {
	
	
    // $() will work as an alias for jQuery() which is noconflict mode inside of this function
});
</script>

------------------------------------------------

fabienthomas/Enqueue Script and Style to website head from a plugin ( PHP)

if ( !is_admin() ) {
	add_action('wp_print_styles', 'wpe_styles');
	add_action('init','wpe_scripts');
	function wpe_styles() {
	    $wpe_css_Url = WP_PLUGIN_URL . '/wp-estate/wp-estate.css';
	    $wpe_css_File = WP_PLUGIN_DIR . '/wp-estate/wp-estate.css';
	    if ( file_exists($wpe_css_File) ) {
	        wp_register_style('wpe_styles', $wpe_css_Url);
	        wp_enqueue_style( 'wpe_styles');
	    }
	}
	function wpe_scripts() {
		$wpe_scripts_Url = WP_PLUGIN_URL . '/wp-estate/wp-estate.js';
	    $wpe_scripts_File = WP_PLUGIN_DIR . '/wp-estate/wp-estate.js';
	    if ( file_exists($wpe_scripts_File) ) {
		wp_register_script('wpe_scripts',$wpe_scripts_Url, array('jquery'),'' );
  		wp_enqueue_script('wpe_scripts');
  		}
	}
}

Ben/Call jquery in wordpress ( jQuery)

<?php wp_enqueue_script("jquery"); ?>

FrederickWeiss/jquery-verison-functions-file ( PHP)


function my_init_method() {
    if (!is_admin()) {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }
}    
 
add_action('init', 'my_init_method');

selfmadepsyche/Loading Javascript Libraries in Wordpress generated page ( PHP)

<?php wp_enqueue_script('jquery'); ?>  

<?php wp_enqueue_script('jquery'); ?>



<?php wp_enqueue_script('newscript','/wp-content/plugins/someplugin/js/newscript.js',array('jquery'),'1.0' ); ?>

Load jQuery into WordPress generated pages, the wpenqueuescript function can be used in plugins as well. OR Add and load a new script that depends on jQuery (this will also cause it to load jQuery into the page as well).

touffies/Function Hint ( jQuery)

/*  ------------------------------------------------------------------
    Hint ------------------------------------------------------------- */
    $.fn.hint = function(settings) {

        // defaults settings
        settings = $.extend({
            classFocus: "focus",
            classOver: "hover",
            classLabelError: "error"
        }, settings);

        return this.each( function() {
            var elm = $(this);
            var title = elm.attr('title');

            elm // on focus, set value to blank if current value matches title attr
            .bind("focus", function(){
                if(settings.classLabelError) { elm.removeClass(settings.classLabelError); }
                //if(settings.classLabelError &amp;&amp; elm.is(".v-mandatory")) { $("label[@for=" + elm.attr("id") + "]").removeClass(settings.classLabelError); }
                if (title &amp;&amp; elm.val() == title) { elm.val(''); }
                elm.addClass(settings.classFocus);
            })
            .bind("blur", function(){
                if (title &amp;&amp; elm.val() === '') { elm.val(title); }
                elm.removeClass(settings.classFocus);  
            })
            .addHover(settings.classOver)
            .blur();// now change all inputs
        });
    };

Fix IE focus, hover and check if there's a default placeholder name

richbdesign/Jquery function ( jQuery)

<script type="text/javascript">
$(function() {
    var delay = 400;
    
    function hideMenu() {
        if (!$('.custom_button').data('in') &amp;&amp; !$('.hover_menu').data('in') &amp;&amp; !$('.hover_menu').data('hidden')) {
            $('.hover_menu').fadeOut('fast');
            $('.custom_button').removeClass('active');
            $('.hover_menu').data('hidden', true);
        }
    }
    
    $('.custom_button, .hover_menu').mouseenter(function() {
        $('.hover_menu').fadeIn('fast');
        $('.custom_button').addClass('active');
        $(this).data('in', true);
        $('.hover_menu').data('hidden', false);
    }).mouseleave(function() {
        $(this).data('in', false);
        setTimeout(hideMenu, delay);
    });    
    
});
</script>

dougunderscorenelson/jQuery Delay ( JavaScript)

$.fn.delay = function(time, callback){
	    // Empty function:
	    jQuery.fx.step.delay = function(){};
	    // Return meaningless animation, (will be added to queue)
	    return this.animate({delay:1}, time, callback);
	}

Swiped from here - http://james.padolsey.com/javascript/jquery-delay-plugin/

manec/Jquery AJAX function ( JavaScript)

<input class="q" type="text" id="contenido" name="contenido" onKeyUp="lookup(this.value);">

function lookup(inputString){
if (inputString.lenght==0){
$('#div').hide();
}else{
$.post("rpc_contenido.php", {queryString:""+inputString+""},function(data){
if(data.lenght>4){
$(#div).show();
$('#div2').html(data);
}else{
$(?#div').hide();
}
});
}
}

djalisko191/Scroll to top function ( jQuery)

$(function () {
    $("#white-paper-call-out").click(function () {
        $('html, body').animate({
            scrollTop: $("#form-lawyerist").offset().top
        }, 2000);
        $(".white-paper-input").focus();
        return false;
    });
});

rhysburnie/Polyfill placeholder functionality for inputs ( jQuery)

/**
* Augment placeholder functionality for inputs
*/
if(!Modernizr.input.placeholder){
	$('input[placeholder]').each(function(){
		var el = $(this)
			, placeholder = el.attr('placeholder')
			;
		
		el.bind({
			focus: function()
			{
				var el = $(this);
				if($.trim(el.val())==placeholder) el.val('');
			}
			, blur: function()
			{
				var el = $(this);
				if($.trim(el.val())=='') el.val(placeholder);
			}
		});

		if($.trim(el.val())=='') el.val(placeholder);
	});
}

Assumed support detection: Modernizr otherwise use some other