Codeinwp / Nivo-Lightbox-jQuery

A simple, flexible, responsive, retina-ready jQuery lightbox plugin.
http://dev7studios.com/nivo-lightbox
MIT License
157 stars 87 forks source link

Using JQuery plugin in the WordPress functions file #42

Open paaljoachim opened 9 years ago

paaljoachim commented 9 years ago

Hey

I have this article under development: http://easywebdesigntutorials.com/adding-a-lightbox-to-wordpress-without-using-a-plugin/

I have the following code added to the child theme functions.php file.

/* Enqueue Nivo - http://dev7studios.com/ - works ok - no semi transparent background color, does not show original image size */ add_action( 'wp_enqueue_scripts', 'enqueue_nivoLightbox' ); function enqueue_nivoLightbox() {

wp_enqueue_style( 'nivoLightbox-css', get_bloginfo( 'stylesheet_directory' ) . '/nivo/nivo-lightbox.css', array(), CHILD_THEME_VERSION );

wp_enqueue_script( 'nivoLightbox', get_bloginfo( 'stylesheet_directory' ) . '/nivo/nivo-lightbox.js', array( 'jquery' ), '1.5.13' );

wp_enqueue_script( 'nivoLightbox-init',  get_stylesheet_directory_uri() . '/nivo/nivoLightbox-init.js', array( 'nivoLightbox' ), '1.0.0', true );

}

I have a difficult time having a semi transparent overlay that hides the background page and focuses on the open lightbox image. It would also be nice to show the default image size that does not resize to the view port.

I also have this nivoLightbox.init code:

jQuery(function( $ ){ $("a[href$='.jpg'],a[href$='.png'],a[href$='.gif']").nivoLightbox(); $('a.gallery').nivoLightbox(); });

It would be nice to also add the gallery code as well as knowing more about the various customizations and variations of them. More then what is listed on your web page.

I would like to add an improved way of using Nivo lightbox to the article that I am writing for all those who want the non plugin way of using Nivo in WordPress.

Have a great day!

ps Perhaps I should have posted this in the WordPress plugin section, but since I am using the JQuery way I am thinking here is the right place to post. Also it would be interesting to adding your slider in a similar way to how I add the lightbox (if possible).