Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to show spmodal on mouse hover.

Vijay Kumar19
Tera Contributor

I want to show a spmodal on mouse hover on menu item. And can we change the position of model, i want to show it just under menu item just like a sub menu.

2 REPLIES 2

Mohith Devatte
Tera Sage
Tera Sage

Hello vijay you can try this 

 

HTML:

<!--button-->
<div type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#modal1" id="b1">Launch Left Modal</div>

<!--modal window code-->
 <div class="modal fade" id="modal1" tabindex="-1" role="dialog" aria-labelledby="modal1Label" aria-hidden="true">
        <div class="modal-dialog modal-sm modal-left">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span>

                    </button>
                     <h4 class="modal-title" id="modal1Label">Left Modal title</h4>

                </div>
                <div class="modal-body">Some Demo For Modal 1</div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>



            </div>
        </div>
    </div>

 

Client controller:

$("#b1").hover(function () {
    $('#modal1').modal({
        show: true,
        backdrop: false
    })
});

 

CSS:

#target {
    height: 400px;
    width: 600px;
    padding: 20px;
    margin: 10px auto;
    border: 1px solid gray;
    border-radius: 4px;
    position: relative;
}
.modal {
    position: absolute;
}
.modal-left {
    margin: 30px;
}
.modal-right {
    margin: 30px;
    float: right;
}

 

This will give you the output for hover modal window 

Hope this helps 

OR YOU CAN USE A DIRECTIVE CALLED "NG-MOUSEOVER"

REFER THIS BELOW LINK

https://www.w3schools.com/angular/ng_ng-mouseover.asp

 

MARK MY ANSWER CORRECT IF THIS HELPS YOU

Hello vijay ,

did my answer help you ?

if yes please close the thread by marking the answer correct so that it ends in solved queue

thanks