Is it possible to generate graphic shapes on the HTML5 canvas and how can I display the cursor as a pointer when a user hovers over the shape?

I am looking to design a unique timeline featuring a train of scrollable sections represented by rectangular shapes, with each section connected to events shown as vertically connected tooltips. My goal is to make these sections and events graphical objects that can display information to the user when clicked on.

Is there a method to create graphical shapes as objects in JavaScript? Additionally, I am searching for a way to change the cursor to a pointer when hovering over these shapes.

Answer №1

Check out this HTML5 SVG code for creating concentric circles:

<!DOCTYPE html>
<html>
<body>
<div style="margin-left:100px;">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="400" cy="400" r="200" stroke="black" class='yellow_cir' stroke-width="2" fill="red" />
<circle cx="400" cy="400" r="150" stroke="black" class='yellow_cir' stroke-width="2" fill="yellow" />
<circle cx="400" cy="400" r="100" stroke="black" class='yellow_cir' stroke-width="2" fill="cyan" />
<circle cx="400" cy="400" r="50" stroke="black" class='yellow_cir' stroke-width="2" fill="cyan" />
  <defs>
     <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:rgb(255,255,255);
      stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(100,100,105);stop-opacity:1" />
    </radialGradient>

     <radialGradient id="grad2" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:rgb(255,255,255);
      stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(10,10,105);stop-opacity:1" />
    </radialGradient>
  </defs>
</svg> 



</div>
</body>
</html> 
<style type="text/css">


.yellow_cir:hover{ fill:url("#grad2");cursor:pointer;
}
.yellow_cir
{
    fill:url("#grad1");
}
</style>

Answer №2

One option is to incorporate a jquery plugin that can create and showcase a Timeline. Implementing this tool could potentially streamline your tasks.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating replicas of objects using the .load() method

Looking for a better approach to handle my Ajax requests, as currently, I am facing an issue where my Gallery Objects (images) are getting duplicated when requested using .load() The content of the Show action is called from the index page <div id="pr ...

Ajax request terminated while sending parameters

Trying to redirect to http://google.com using an ANCHOR tag, while also posting parameters to another page via AJAX is causing the POST request to be aborted even though the redirection is successful. Here is the code snippet: <script type="text/ja ...

Is it possible to load the surrounding markup in Angular before the guards are resolved upon the initial load of the router-outlet?

Within our Angular 12 application, we have implemented guards that conduct checks through API calls to the backend in order to validate the user's permissions for accessing the requested route. The default behavior of these guards follows an all-or-no ...

bringing in documents from a shared repository

Exploring the folder structure below: MainFolder ├──sourceFolder │ └──assetsFolder │ ├──GlobalStyles.js │ ├──colors.js │ ├──images.js │ ├──someOtherFile.js │ └──package.json <-- ...

The string in the text remains unchanged

Currently, I am attempting to replace specific strings as text is entered into the input field. The strings in question are {b} and {\b}. However, I have noticed that not all instances of these strings are being replaced, leaving some behind. Below is ...

The data retrieved through ajax remains consistent every time

It seems like there might be a server-side cache causing issues on my server... Every time I make a request for content using jQuery AJAX, I receive the same data, even after replacing the server-side code with echo('hello, world!'); The confi ...

Tips for transferring information and directing a user to a specific webpage through a hyperlink

I recently learned about a way to send data and direct the user to a new page without utilizing a form. Currently, I have a page displaying products (titled products) with an edit button that, when clicked, directs me to another page named "edit-product." ...

What is the best method for inserting the HTML content from a specific div into a textarea?

Everything seems to be working fine, but once I insert the HTML into the textarea, an issue arises where the div gets wrapped within another div, causing the layout to break. var urls = []; $('body').on('click', '.btn_video&apos ...

Issues with ZeroClipboard

I am attempting to utilize Zeroclipboard for copying content to the clipboard, but it doesn't appear to be functioning properly. Here is my code: HTML: <textarea name="texter" id="texter"></textarea> <input type="button" value="Copy t ...

Confidential data in Module Design

I'm curious about the concept of private variables in JavaScript. How is it that I can still access a private variable through a public method and redefine the properties of the module? For example: var aModule = (function() { var privateVar = 1 ...

The appearance of a soft keyboard on mobile devices causes the resizing of the web

View before keyboard appears View after keyboard pops up I want the layout to remain unchanged when the keyboard shows, allowing users to scroll freely. Below is the code snippet: <html> <header> <title>Test Page</title> <meta ...

The function does not yield any result

import { Injectable } from '@angular/core'; export class Test { public id: number; public name: string; public fid: number }; export const TESTS2: Test[] = [ {id: 1, name: 'Lion', fid: 1}, {id: 2, name: 'Tiger', fid: 1 ...

Setting up Quill in a Nuxt project (a VUE component)

I'm struggling to remove the toolbar in Quill despite my efforts. This is the HTML snippet I am working with: <template> <quill v-model="content" :config="config"></quill> </template Here's what I have inside the scri ...

Unexpected response: The JQuery AJAX request did not return the expected JSON data

Within my code snippet below, I have successfully obtained an object that, when printed to the console, begins with: {readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ,  …} However, up ...

Blocking a thread on getJSON: Step by step guide

Currently facing a situation where I have to perform two web service calls in my JQuery 1.9.1 application. The outcome of the first call is required before proceeding with the second one. After attempting getJSON requests, it seems that they do not block ...

Is there a way to determine if an input field is currently focused in vue.js?

Is there a way to display a div when an input is in focus using Vue.js? ...

The method to extract data from a <td> element using BeautifulSoup

There is a page I'm working with that contains tables in its source code: <td class="ng-binding">9:20 AM</td>, <td class="ng-binding"><span class="ng-binding" ng-bind-html="objFlight.flight.stat ...

Passing an anonymous function as a parameter to a function in ng-init is a common practice in AngularJS v1.4.8

Is it possible to save a call to an anonymous function using ng-init? For example: <div class="container-fluid" ng-app="AVF" ng-controller="ConfigController" ng-init="RegisterInitFunction(function() { $scope.GetData(); })" > In my controller: ...

Executing the npm run test command with the unsafe-perm flag within the lifecycle phase

My React/Redux app is working fine, but whenever I run the command below: npm run test An error occurs as shown below: 6 info lifecycle [email protected]~test: [email protected] 7 verbose lifecycle [email protected]~test: unsafe-perm in li ...

Find and Scroll Dropdown Menu with Bootstrap Framework

Access the jsfiddle for more information. Have a look at these questions: In my dropdown menu, I have included a search box and multiple sub-menus. However, the search box only filters the first dropdown menu and does not work with the sub-menus. How ca ...