Masonry don't work
-
Hi WP friends,
I’m trying to get the Masonry JQuery plugin working, and I can’t figure out why it isn’t.
This is what I did:
1) wp_enqueue_script
add_action( 'wp_enqueue_scripts', 'jk_masonry' ); function jk_masonry() { wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) ); }
2) Init the script
function my_masonry() { ?> <script type="text/javascript"> jQuery(document).ready(function($){ $('#home_content').masonry({ itemSelector: '.widgetcontainer', columnWidth: 300, }); }); </script> <?php } add_action('init', 'my_masonry');
3) Structured my HTML
<div id="home_content"> <div class="widgetcontainer widget_text"> <div class="widgetcontainer widget_text"> <div class="widgetcontainer widget_recent_entries"> <div class="widgetcontainer widget_rfb_widget"> </div>
4) Structured my CSS
#home_content { width: 900px; padding: 0; border: 0; } #home_content .widgetcontainer { width: 300px; }
Using Firebug I can see that the plugin was initialized, the script is in the head and the HTML and CSS are ok… but nothing happens.
Why I am doing wrong???
Thanks!!!
- The topic ‘Masonry don't work’ is closed to new replies.