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:


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
    "I simply can't get it to work" --> Any error messages? Debugging info? What does the JS console say? – Johannes Pille Sep 30 '13 at 19:27

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, privacy policy and cookie policy

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