Support » Plugin: ImageMapper » Solution: Make ImageMapper Responsive

  • 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 8 months, 2 weeks ago by  Garrett Hyder. Reason: *Fixed the code block formatting
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.