• Resolved bxwebber

    (@bxwebber)


    HI!

    I’m trying to replace a plugin function but I’m stuck in how to do that. Help would be much appreciated!

    The plugin is Slim Jetpack, the Tiled Gallery to be precise. In the plugin’s original .js file this is the part I want to replace:

    TiledGallery.prototype.Captions = function() {
    	/* Hide captions */
    	this.caption.hide();
    
    	this.item.on( 'hover', function() {
    		$( this ).find( '.tiled-gallery-caption' ).slideToggle( 'fast' );
    	});
    };

    I want to replace it with this:

    TiledGallery.prototype.Captions = function() {
    	/* Hide captions */
    	this.caption.hide();
    
    	this.item.hover(
    		function() { $( this ).find( '.tiled-gallery-caption' ).slideDown( 'fast' ); },
    		function() { $( this ).find( '.tiled-gallery-caption' ).slideUp( 'fast' ); }
    	);
    	this.item.click(
    		function() { $( this ).find( '.tiled-gallery-caption' ).slideUp( 'fast' ); }
    	);
    };

    but of course I don’t want to change the original file, I ‘d like to use my child theme’s function.php.
    I’ve found a few articles on the subject, but most are confusing, since I don’t know that much about scripting. I can’t figure out what is supposed to be going where.

    Thanks if you can help out!

    (PS my site is still only local on my machine)

  • The topic ‘How to replace a specific gallery function?’ is closed to new replies.