• Resolved Garrett Hyder

    (@garrett-eclipse)


    Hello,

    I just wanted to share a quick little jQuery snippet for making ImageMapper images responsive;

    
    // Responsive ImageMapper - Resize Mapster on Window Resize
    jQuery(document).ready(function($) {
        if ($('img[usemap]').length) {
            $(window).resize( function() {
                $('img[usemap]').each(function() {
                    $(this).mapster('resize',$(this).closest('.imgmap-frontend-image').width());
                });
            });
        }
    });
    

    Note: You need to make sure this is enqueued after the imagemapper scripts and jquery.

    Hope others find this useful,
    Cheers

    • This topic was modified 9 years, 2 months ago by Garrett Hyder. Reason: *Fixed the code block formatting
Viewing 9 replies - 1 through 9 (of 9 total)
  • KrisArgent

    (@krisargent)

    Thank you for this!

    Thread Starter Garrett Hyder

    (@garrett-eclipse)

    No worries, glad it’s helped someone

    Hi

    Where do you insert this code?

    Thread Starter Garrett Hyder

    (@garrett-eclipse)

    Hi @gustav939,

    You can place in your javascript file, just make sure it’s enqueued after the imagemapper script. If you don’t have an existing JS file then create a new one with this code and enqueue it into your theme.

    Enqueue Script in WordPress – https://developer.wordpress.org/reference/functions/wp_enqueue_script/

    Hope that helps, in worst case you can just add within <script></script> tags within your footer.php after the wp_footer() call.

    Cheers

    Perfect!
    Thanks so much

    Still works perfectly. Great.

    linae

    (@linae)

    Thank you very much you save me !

    Hey guys , I’m having an issue. All areas are on the place but one of them is a bit off.

    The website im working on is : http://naujas.pajuriorezidencija.lt ( see the parking area on the landing page)

    any clue why? All other screen resolution working fine , just the 1920×1080 is wrong.

    Thread Starter Garrett Hyder

    (@garrett-eclipse)

    Hi @andza1,

    As this topic is closed you’ll be better served opening a fresh topic otherwise your post will be overlooked.

    Taking a quick look it’s hard to say, seems you’ve customized the plugin code directly which makes it difficult to determine if the cause is the plugin or your customizations. You might want to start by separating your customizations into your child theme and out of the plugin so you can test if it’s a plugin issue or your code.

    Hope that sends you down the right path.
    Cheers

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Solution: Make ImageMapper Responsive’ is closed to new replies.