简体   繁体   English

将鼠标悬停在svg圆圈上显示每个元素的工具提示

[英]hover on svg circle show tooltip for each element

I'm designing a website for myself. 我正在为自己设计一个网站。 I have created three svg circle when I hover or mouseenter on each svg circle should show different tooltip images. 当我将鼠标悬停在每个svg圆上时,我应该创建三个svg圆,以显示不同的工具提示图像。 I've tried but it's not working. 我已经尝试过了,但是没有用。 I'm using materialcss framework when I use push class to push all the three colors to the right side of the screen leaving some margin. 当我使用push类将所有三种颜色都推到屏幕的右侧时,我正在使用materialcss框架,从而留出一些空白。

 $('svg[data-toggle="tooltip"]').tooltip({ animated: 'fade', placement: 'bottom', html: true }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="row"> <div class="priority-order"> <div class="col l1 m1 s1 push-l9"> <svg height="100" width="100" data-toggle="tooltip" title="<img src='images/4%20projects%202.jpg' style='height:100px;width:100px' />"> <circle cx="50" cy="50" r="10" stroke-width="3" fill="#f0584f" /> </svg> </div> <div class="col l1 m1 s1 push-l9"> <svg height="100" width="100"> <circle cx="50" cy="50" r="10" stroke-width="3" fill="#3166ff" /> </svg> </div> <div class="col l1 m1 s1 push-l9"> <svg height="100" width="100"> <circle cx="50" cy="50" r="10" stroke-width="3" fill="#5fb336" /> </svg> </div> </div> </div> 

我已经设计了这个页面

This is the present homescreen 这是当前的主屏幕

在此处输入图片说明

I created custom tooltip of my own by CSS. 我通过CSS创建了自己的自定义工具提示。 This research took me one day to complete the task. 这项研究花了我一天的时间来完成任务。

 .priority-order svg{ float: right; margin-left: -25px; } /*tooltips green color dot*/ a.tooltips { position: relative; right: 5px; float: right; } a.tooltips span { position: absolute; width: 80px; color: #FFFFFF; background: #5FB336; height: 29px; line-height: 29px; text-align: center; visibility: hidden; border-radius: 8px; } a.tooltips span:after { content: ''; position: absolute; bottom: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-bottom: 8px solid #5FB336; border-right: 8px solid transparent; border-left: 8px solid transparent; } a:hover.tooltips span { visibility: visible; opacity: 1; top: 50px; left: 30%; margin-left: -57px; z-index: 999; cursor: pointer; } /*tooltips1 blue color dot*/ a.tooltips1 { position: relative; right: 5px; float: right; } a.tooltips1 span { position: absolute; width: 80px; color: #FFFFFF; background: #3166ff; height: 29px; line-height: 29px; text-align: center; visibility: hidden; border-radius: 8px; } a.tooltips1 span:after { content: ''; position: absolute; bottom: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-bottom: 8px solid #3166ff; border-right: 8px solid transparent; border-left: 8px solid transparent; } a:hover.tooltips1 span { visibility: visible; opacity: 1; top: 50px; left: 30%; margin-left: -57px; z-index: 999; cursor: pointer; } /*tooltips1 red color dot*/ a.tooltips2 { position: relative; right: 5px; float: right; } a.tooltips2 span { position: absolute; width: 80px; color: #FFFFFF; background: #f0584f; height: 29px; line-height: 29px; text-align: center; visibility: hidden; border-radius: 8px; } a.tooltips2 span:after { content: ''; position: absolute; bottom: 100%; left: 50%; margin-left: -8px; width: 0; height: 0; border-bottom: 8px solid #f0584f; border-right: 8px solid transparent; border-left: 8px solid transparent; } a:hover.tooltips2 span { visibility: visible; opacity: 1; top: 50px; left: 30%; margin-left: -57px; z-index: 999; cursor: pointer; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="row"> <div class="priority-order"> <div class=""> <a class="right tooltips" href="#"><svg height="40" width="100" class=""> <circle cx="30" cy="30" r="10" stroke-width="3" fill="#5fb336" /> <span>Clear</span> </svg></a> </div> <div class=""> <a class="right tooltips1" href="#"><svg height="40" width="100" class=""> <circle cx="30" cy="30" r="10" stroke-width="3" fill="#3166ff" /> <span>Issue</span> </svg></a> </div> <div class=""> <a class="right tooltips2" href="#"><svg height="40" width="100" class=""> <circle cx="30" cy="30" r="10" stroke-width="3" fill="#f0584f" /> <span>Alert</span> </svg></a> </div> </div> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM