Skip to content

Instantly share code, notes, and snippets.

@lucafrgoulart
Created October 6, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucafrgoulart/178c33ddc942e250f2d36f176a8dca8e to your computer and use it in GitHub Desktop.
Save lucafrgoulart/178c33ddc942e250f2d36f176a8dca8e to your computer and use it in GitHub Desktop.
Roleta Promocional
<div class="skills-wheel">
<ul class="wheel">
<li>
<a href="#commercial-awareness" class="fancybox">1. Promo</a>
</li>
<li>
<a href="#communication" class="fancybox">2. Promo</a>
</li>
<li>
<a href="#teamwork"class="fancybox">3. Promo</a>
</li>
<li>
<a href="#negotiation" class="fancybox">4. Promo</a>
</li>
<li>
<a href="#problem-solving" class="fancybox">5. Promo</a>
</li>
<li>
<a href="#leadership" class="fancybox">6. Promo</a>
</li>
<li>
<a href="#organisation" class="fancybox">7. Promo</a>
</li>
<li>
<a href="#entrepreneurial-skills" class="fancybox">8. Promo</a>
</li>
</ul> <a href="#/" title="TITLE TEXT." class="btn">Run Forest!</a>
</div>
<!-- OVERLAY Commercial Awareness -->
<div id="commercial-awareness" class="hide">
<h2>Desconto 1</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Communication -->
<div id="communication" class="hide">
<h2>Desconto 2</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Teamwork -->
<div id="teamwork" class="hide">
<h2>Desconto 3</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Negotiation -->
<div id="negotiation" class="hide">
<h2>Desconto 4</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Problem Solving -->
<div id="problem-solving" class="hide">
<h2>Desconto 5</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Leadership -->
<div id="leadership" class="hide">
<h2>Desconto 6</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Organisation -->
<div id="organisation" class="hide">
<h2>Desconto 7</h2>
<p>Você ganhou um desconto!</p>
</div>
<!-- OVERLAY Entrepreneurial Skills -->
<div id="entrepreneurial-skills" class="hide">
<h2>Desconto 8</h2>
<p>Você ganhou um desconto!</p>
</div>
// sequential order
// advances 3 segments each click
var _target, _deg = 0;
function ordSequential() {
// order : 1,4,7,2,5,8,3,6 ... then loops
return _deg = _deg + (45*3) + 1080;
};
jQuery(document).ready(function ($) {
$(".skills-wheel .btn").on("click", function (e) {
// select algorithm sequential, random or preset :
ordSequential();
_target = (_deg - (360 * parseInt(_deg / 360))) / 45;
// start animation
// reset opacity of all segments to 1
$(".fancybox").parent("li").velocity({
opacity: 1
}, {
duration: 100,
complete: function () {
$(".wheel").velocity({
rotateZ: "-" + _deg + "deg"
}, {
duration: 3000,
complete: function (elements) {
// after spinning animation is completed, set opacity of target segment's parent
$(".fancybox").parent("li").eq(_target).velocity({
opacity: 0.4
}, {
duration: 100,
// after opacity is completed, fire targeted segment in fancybox
complete: function () {
$(".fancybox").eq(_target).trigger("click");
} // third animation completed
}); // nested velocity 2
} // second animation completed
}); // nested velocity 1
} // first animation completed
}); // velocity
return false;
}); // click
// initialize fancybox
$(".fancybox").fancybox({
maxWidth: "85%"
});
}); // ready
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/velocity/1.0.0/velocity.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
.hide {
display: none;
}
.skills-wheel {
/*-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);*/
border: 1px solid #000;
box-sizing: border-box;
height: 560px;
margin: 0 auto 2em;
overflow: hidden;
position: relative;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
width: 560px;
}
.skills-wheel:before {
border-style: solid;
border-width: 32px 32px 0 32px;
border-color: #ffffff transparent transparent transparent;
content:"";
height: 0;
left: 50%;
margin-left: -32px;
position: absolute;
top: 8px;
z-index: 100;
width: 0;
}
.skills-wheel .btn {
background-color: #404040;
color: #fff;
border: 4px solid #ffffff;
-webkit-box-shadow: inset 0 -8px 0 #2b2b2b;
-moz-box-shadow: inset 0 -8px 0 #2b2b2b;
box-shadow: inset 0 -8px 0 #2b2b2b;
font-family:"avantgarde_bold", Helvetica, Arial, sans-serif;
height: 100px;
left: 50%;
line-height: 100px;
margin: -54px 0 0 -54px;
padding: 0;
position: absolute;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
text-decoration: none;
text-align: center;
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
text-transform: uppercase;
top: 50%;
width: 100px;
}
.skills-wheel .btn:active {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
height: 96px;
margin-top: -50px;
}
.wheel {
border: 12px solid #ffffff;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
height: 100%;
margin: 0 auto;
overflow: hidden;
position: relative;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
text-align: center;
width: 100%;
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-ms-transform-origin: center center;
-o-transform-origin: center center;
transform-origin: center center;
}
.wheel li {
font-family:"avantgarde_bold", Helvetica, Arial, sans-serif;
font-size: 12px;
font-size: 1.2rem;
height: 50%;
line-height: 18px;
list-style: none;
left: 50%;
margin: 0 0 0 -106px;
padding: 0;
position: absolute;
-webkit-transform-origin: center bottom;
-moz-transform-origin: center bottom;
-ms-transform-origin: center bottom;
-o-transform-origin: center bottom;
transform-origin: center bottom;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
top: 0;
width: 39.552238806%;
}
.wheel li:before {
display: none;
}
.wheel a {
color: #000;
left: 0;
position: absolute;
text-decoration: none;
top: 48px;
width: 100%;
}
.wheel li:nth-child(1) {
-webkit-transform: rotate(0);
-moz-transform: rotate(0);
-ms-transform: rotate(0);
-o-transform: rotate(0);
transform: rotate(0);
}
.wheel li:nth-child(2) {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
.wheel li:nth-child(3) {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
.wheel li:nth-child(4) {
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
}
.wheel li:nth-child(5) {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
.wheel li:nth-child(6) {
-webkit-transform: rotate(225deg);
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
-o-transform: rotate(225deg);
transform: rotate(225deg);
}
.wheel li:nth-child(7) {
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
}
.wheel li:nth-child(8) {
-webkit-transform: rotate(315deg);
-moz-transform: rotate(315deg);
-ms-transform: rotate(315deg);
-o-transform: rotate(315deg);
transform: rotate(315deg);
}
.wheel li:nth-child(odd) img {
-webkit-opacity: 0.8;
-moz-opacit: 0.8;
opacity: 0.8;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment