Home > other >  svg as cursor url value not getting applied
svg as cursor url value not getting applied

Time:10-18

I want to use an svg for cursor icon when the required details matches

the svg i'm using (ik its png to upload here) enter image description here

.apply-copy{
    cursor: url('./icons/apply-format.svg'),auto;
}

how i'm changing the cursor

document.querySelector('.ck-editor__editable').classList.add('apply-copy');

CodePudding user response:

Here is an example to apply the special cursor to the second .item class.

Your code maybe working.. but make sure that your image path is correct url('./icons/apply-format.svg')

document.getElementsByClassName('item')[1].classList.add('cursor');
.item{
  padding: 10px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  margin: 5px auto;
  max-width: 150px;
  text-align: center;
  cursor: default;
}

.cursor{
  cursor: url('https://i.stack.imgur.com/ehitY.png'), auto; 
}
<div class="item">something</div>
<div class="item">something</div>
<div class="item">something</div>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related