I need to create more than one pointer as the same image that is in the css how do I do this?
ponteiro = document.querySelector("#ponteiro");
#ponteiro{
background-image: url("../img/ponteiro.png");
}
<div id="ponteiro"></div>
I need to create more than one pointer as the same image that is in the css how do I do this?
ponteiro = document.querySelector("#ponteiro");
#ponteiro{
background-image: url("../img/ponteiro.png");
}
<div id="ponteiro"></div>
You can clone your div, however this would duplicate the id (which is not recommended). So using the class attribute you can select the original div and clone the element, if you need to assign an id to the new element I can add that to the response.
$(document).ready(function(){
var ponteiro = $(".ponteiro:first");
$("#btnClone").on('click', function(){
$('body').append($(ponteiro).clone(true));
});
});
.ponteiro{
position:relative;
background-image: url("../img/ponteiro.png");
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><inputtype="button" id="btnClone" value="clonar" />
<div class="ponteiro">texto para visualização do exemplo</div>