GianlucaGuarini Black&white image jquery in WP?
-
I’m trying to impliement this black&white image jquery script in WP. It doesn’t seem to effect the images.
I’m using thematic with a child theme.In the functions.php I added…
function boererepublieke_scripts() {
wp_register_script( 'black-white', get_stylesheet_directory_uri().'/js/jQuery.BlackAndWhite.min.js', array('jquery'));
wp_enqueue_script('jquery');
wp_enqueue_script('black-white');
}
add_action('wp_enqueue_scripts', 'boererepublieke_scripts');And then…
function boererepublieke_bw() {
if(is_post()) {?>
<script>
$(window).load(function(){
$('.bwWrapper').BlackAndWhite({
hoverEffect : true, // default true
// set the path to BnWWorker.js for a superfast implementation
webworkerPath : false,
// for the images with a fluid width and height
responsive:true,
// to invert the hover effect
invertHoverEffect: false,
speed: { //this property could also be just speed: value for both fadeIn and fadeOut
fadeIn: 200, // 200ms for fadeIn animations
fadeOut: 800 // 800ms for fadeOut animations
}
});
});
</script> <?php
}
}
add_filter('wp-head','boererepublieke_bw');I then added the .bwWrapper class through the advanced image editor. But nothing seems to happen.
Also:
How can I wrap extra divs around a image in a post? I’ve searched high and low and the only option seems to be a preg_replace(). That’s crazy. Isn’t there a filter somewhere that could add these elements around a image?Thanks for your time!
- The topic ‘GianlucaGuarini Black&white image jquery in WP?’ is closed to new replies.