0

I use jquery, ImageMapster and PHP.

The script works fine, if I load the imagen my area is ON but when I move my mouseOver the image the highlight change ( normal ) but ... when I put my mouseOut of img I have no area selected, and would like my default area ON.

I fix the problem using mouseOut calling always the same area. I would like to do it correctly.

 <script type="text/javascript">
        function mapearImagenVistaGeneral(id) {
            $(id).mapster({
                mapScale     : true,
                fillOpacity  : 0.4,
                fillColor    : "fff000",
                stroke       : true,
                strokeColor  : "000",
                strokeOpacity: 0.8,
                strokeWidth  : 4,
                singleSelect : true,
                mapKey       : 'name',
                listKey      : 'name',
                showToolTip  : true,
                onMouseout: function (e) {
                    $('#imgAlmacen1VistaGeneral').mapster( 'highlight','01');            
                }
            });
        };
        mapearImagenVistaGeneral("#imgAlmacen1VistaGeneral");        
        $('#imgAlmacen1VistaGeneral').mapster( 'highlight','01'); 
Unai Susperregi
  • 398
  • 3
  • 16
  • Please post a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – Alexandre Elshobokshy Jan 15 '19 at 10:01
  • I think that you dont need more code, because the option should be ImageMapster option. No HTML, PHP or other code, because this code "works" but I would like to do it better. – Unai Susperregi Jan 15 '19 at 10:19
  • I think you're missing the meaning of an MCV, you need to post a full working code of whatever you're posting so we would be able to test easily. We can't guess how to do it better, and we won't try and recreate your problem as that's your job. I hope I'm clear :) – Alexandre Elshobokshy Jan 15 '19 at 10:21
  • Thank you and sorry for bothering you,finally I found the solution after 2 days. – Unai Susperregi Jan 15 '19 at 10:33

1 Answers1

0

After 2 days finally I found the solution now, after write in stackoverflow...

I have to set one area.

 <script type="text/javascript">
        function mapearImagenVistaGeneral(id) {
            $(id).mapster({
                mapScale     : true,
                fillOpacity  : 0.4,
                fillColor    : "fff000",
                stroke       : true,
                strokeColor  : "000",
                strokeOpacity: 0.8,
                strokeWidth  : 4,
                singleSelect : true,
                mapKey       : 'name',
                listKey      : 'name',
                showToolTip  : true,
                areas: [{
                    key: '01',
                    staticState: true,
                    render_select: {
                        fillOpacity: 0.4,
                        fillColor: '0000ff'
                    }}
                ]
            });
        };
        mapearImagenVistaGeneral("#imgAlmacen1VistaGeneral");        
Unai Susperregi
  • 398
  • 3
  • 16