0

I wan't to include this script in my wordpress theme, making it resize all of the images inside posts according to the current window height:

https://github.com/gutierrezalex/photo-resize

I've made a basic test page in my text editor and it resizes the image just fine. However, when I try to apply/include it in my wordpress theme I simply can't get it to work.

1
  • 1
    "I simply can't get it to work" --> Any error messages? Debugging info? What does the JS console say? Sep 30, 2013 at 19:27

1 Answer 1

2

Download the script (or add it via npm > bower to your theme), wp_enqueue_script() it at the wp_enqueue_scripts hook and then simply add/enqueue another (your custom) script where you add the contents of the demo index.html file:

( function( $ ) {
    $( "img" ).photoResize( {
        bottomSpacing: 15
    } );
} )( jQuery || {} );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.