How not to allow rolling while in effect

Asked

Viewed 22 times

1

Well, here’s the thing I have the following code:

<!DOCTYPE html>
<html lang="PT-BR">
<head>
 <title></title>
 <script src="https://captainskin.com/assets/js/lib.js"></script>
 <style>
 #spin{
 position: relative;
 width: 1024px;
 height: 85px;
 border: 1px solid #ccc;
 z-index: 999;
 }
 #items{
 position: relative;
 overflow: hidden;
 max-width: 1015px;
 height: 80px;
 }
 .img{
  border: 1px solid #ccc;
  background: url(caixa.png);
  float: left;
  width: 120px;
  height: 96px;
 }
 .rol{
 overflow: auto;
 width:22295px;
 display:flex;
 align-items
 min-width: 1000%;
 }
 .ponto{
 width: 2px;
    background-color: #CC2525;
    position: absolute;
    top: -15px;
    bottom: -10px;
    left: 50%;
    margin-left: -1px;
    z-index: 1;
 }
 </style>
 <script>

 function run(off){
$(".rol").css("margin-left", "0px");
 $(".rol").animate({
"margin-left": off*4
},{
duration: 8e3,
easing: "easeOutQuad",
complete: function() {
}
});
};

 </script>
</head>
<body>
<center>
<div id="spin">
<span class="ponto"></span>
<div id="items">
<div class="rol">
<div class="sub">
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/310778737.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1812816683.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/360463485.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/310778737.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1812816683.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/360463485.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/310778737.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1812816683.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/360463485.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/310778737.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1812816683.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/360463485.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/310778737.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1812816683.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/360463485.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/310778737.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1812816683.png"></div>
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/360463485.png"></div>

<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<!-- 1 -->
<div class="img"><img src="https://s3.eu-central-1.amazonaws.com/drakemoon-skins/1104779481.png"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<!-- 2 -->
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<!-- 3 -->
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<div class="img"></div>
<!-- 4 -->

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

</div>
<br>
<br>
<button onclick="taok()">Rodar!</button>

<script type="text/javascript">
function taok(){

var ok = Math.floor(Math.random() * -1490) + -1580  

run(ok);
}
</script>
</body>
</html>

When I click on rotate, the roulette has an effect on it falling into any of the items randomly. What I intended to do was that when I clicked, I was not allowed to click again while it was taking effect, and if the person clicked nothing happened. In a way, I intended to block the button while I was rolling and blocking the js somehow, so that it had no influence on the effect. Once the effect was over, everything was back to normal again.

How can I do?

  • A good question, but nobody was willing to answer? Friend, I just don’t answer because I don’t know how to help.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.