jQuery-rwdImageMaps icon indicating copy to clipboard operation
jQuery-rwdImageMaps copied to clipboard

Initial load not working

Open hamngatan10 opened this issue 10 years ago • 18 comments

The plugin works great except that on initial load the image maps are not working, after resizing it works. How can this be fixed?

See my test page for reference: http://shestore.se/lookbook-test2

hamngatan10 avatar Apr 23 '14 10:04 hamngatan10

Hi Is this issue fixed for you?

rajaveernapu avatar Jun 01 '14 18:06 rajaveernapu

Have you find a solution for this? I tried to call $(window).resize() after calling $("img[usemap]").rwdImageMaps() but nothing has changed. If I look into the code, the plugin sets coords to 0. After a window manual resize, they are recalculated.

[update] the issue appears when image is "display:none".

mattiaaccornero avatar Aug 16 '14 12:08 mattiaaccornero

Hi, I have the same issue now, is this fixed for you? Can anyone help me for this?

Yana1 avatar Oct 29 '14 10:10 Yana1

I am running into the same issue. Still no fix?

kevinweaver avatar Dec 31 '14 19:12 kevinweaver

@kevinweaver you could try to use visibility:hidden instead of display:none.

mattiaaccornero avatar Jan 11 '15 09:01 mattiaaccornero

@beat84 I have no display:none on my image. But still initial load not working.

kiv5 avatar Mar 12 '15 11:03 kiv5

@kiv5 have you a gist with the code?

mattiaaccornero avatar Mar 12 '15 11:03 mattiaaccornero

you can see the code at http://www.voga.com.tr It is on the first slide

kiv5 avatar Mar 12 '15 11:03 kiv5

@kiv5 I can see the image.. which browser are you using?

mattiaaccornero avatar Mar 12 '15 11:03 mattiaaccornero

@beat84 Using chrome but I can also see the image. The problem is about image not working on inital load.

sorry not image - image mapping

kiv5 avatar Mar 12 '15 11:03 kiv5

@kiv5 Oh ok, have you tried to wait some second before call the rwdImageMaps method?

mattiaaccornero avatar Mar 12 '15 11:03 mattiaaccornero

@beat84 no, not actually. But I don't know how to do it.

kiv5 avatar Mar 12 '15 11:03 kiv5

@beat84 How can I try wait some second?

kiv5 avatar Mar 17 '15 11:03 kiv5

@kiv5 Looking at your code, I suggest you to call the rwdImageMaps method at the end of the carousel configuration and initialization. In case you need a delay, try this: http://api.jquery.com/delay/

mattiaaccornero avatar Mar 21 '15 14:03 mattiaaccornero

@beat84 Thank you Mattia! I put a delay. Good news: Initial load works, thanks to you. But now even resizing works, coordinates not working when I resize the window.

Delay update here: $('img[usemap]').rwdImageMaps().delay(800);

UPDATE: It wasn't working, I did a syntax error :)

kiv5 avatar Mar 23 '15 15:03 kiv5

I have this problem too, I found out that .min has this problem, but the unminified version works fine. Considering the directive is very small I guess is ok to use this one

catazep avatar Aug 19 '16 11:08 catazep

I found a solution myself and posted it on the issue underneath. Hope it helps. #115

wardhache avatar Mar 10 '19 21:03 wardhache

If the problem occurs in a modal window or popup(In the case of a modal window with display: none), it can be solved by inserting the image map code into the output button of the modal window.

 $('.menu').click(function menu(e) {

    $(document).ready(function(e) {
        $('img[usemap]').rwdImageMaps();
        $('area').on('mouseover', function() {

            $(".pf3_4 img").attr("src","images/md4_hover.png");
            $('area').css('cursor', 'none');
            $('.cursor').addClass('cursor-grow');

        });
        $('area').on('mouseout', function() {

            $(".pf3_4 img").attr("src","images/md4.png");
            $('area').css('cursor', 'none');
            $('.cursor').removeClass('cursor-grow') 
        });
    });

 });

@mattiaaccornero

Refer to mattiaaccornero's article

jjy9331 avatar Mar 03 '23 17:03 jjy9331