Need some help getting a Jquery library to work - Wordpress Solution
Hello All,
I'm trying to the [[LINK href="http://miromannino.com/projects/justified-gallery/"]]Justified Jquery Library[[/LINK]] for my images post type and have no idea why it isn't working.
I've Enqueue the scripts and stylesheet associated with the jquery plugin and when I inspect element and click on the link for the style sheet and js library everything works. So I pretty sure it's not a problem of how I enqueue the scripts and styles. Here's the [[LINK href="http://pastebin.com/czP4BqRR"]]Enqueue function I have in my functions.php[[/LINK]].
I also tried creating just a normal html document with the foundation framework I'm using in my child theme and the same images from the same src that's hosted on my local server and that worked just fine: [[LINK href="http://pastebin.com/hDJwpsaA"]]Justified html example[[/LINK]]
I also know that you're suppose to the [[LINK href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers"]]no conflict wrappers[[/LINK]] which I am doing.
It's the strangest thing. When I inspect element on the template page I'm using the query with the library on I don't get any errors showing in the console. The library I'm trying to use just straight up doesn't work and I can't figure out for the life of me what I'm doing wrong. [[LINK href="http://pastebin.com/J7CcbKHb"]]Here's the code for the template file I'm trying to make this work with[[/LINK]].
I'm pretty sure I'm just messing something up slightly, but I'm really not sure as to what I'm missing. I'll add more money as always if this question is a lot harder.
I thank you guys for the help I recieve!
Solution - 1
try to add a path to image in the url:
change this part:
with:
Solution - 2
Try this one.
HTML id must be mygallery instead of #mygallery.
I separated PHP code from HTML and moved the javascript call to the bottom, i also call the plugin when ready event is fired.
'images');
$Justified_Query = new WP_Query( $args );
?>
I have had issues with javascript jquery before, I have gotten other jquery scripts to work in the past by trying to include the js file in different places in the header.php file instead of with enque scripts and it has worked. Moving it below or above other .js files can make a difference sometimes. Good luck.