Skip to content

Commit

Permalink
Redesign buttons + add previous button to tooltip buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
afshinm committed Mar 19, 2013
1 parent 324c982 commit ed069c5
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 13 deletions.
26 changes: 20 additions & 6 deletions intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,27 +253,41 @@
tooltipLayer.appendChild(arrowLayer);
helperLayer.appendChild(tooltipLayer);

var skipTooltipButton = document.createElement("a");
skipTooltipButton.className = "introjs-skipbutton";
skipTooltipButton.href = "javascript:void(0);";
skipTooltipButton.innerHTML = "Skip";

//next button
var nextTooltipButton = document.createElement("a");

nextTooltipButton.onclick = function() {
_nextStep.call(self);
};

nextTooltipButton.className = "introjs-nextbutton";
nextTooltipButton.className = "introjs-button introjs-nextbutton";
nextTooltipButton.href = "javascript:void(0);";
nextTooltipButton.innerHTML = "Next →";

//previous button
var prevTooltipButton = document.createElement("a");

prevTooltipButton.onclick = function() {
_previousStep.call(self);
};

prevTooltipButton.className = "introjs-button introjs-prevbutton";
prevTooltipButton.href = "javascript:void(0);";
prevTooltipButton.innerHTML = "← Back";

//skip button
var skipTooltipButton = document.createElement("a");
skipTooltipButton.className = "introjs-button introjs-skipbutton";
skipTooltipButton.href = "javascript:void(0);";
skipTooltipButton.innerHTML = "Skip";

skipTooltipButton.onclick = function() {
_exitIntro.call(self, self._targetElement);
};

var tooltipButtonsLayer = tooltipLayer.querySelector('.introjs-tooltipbuttons');
tooltipButtonsLayer.appendChild(skipTooltipButton);
tooltipButtonsLayer.appendChild(prevTooltipButton);
tooltipButtonsLayer.appendChild(nextTooltipButton);

//set proper position
Expand Down
72 changes: 65 additions & 7 deletions introjs.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,75 @@
}

.introjs-tooltipbuttons {
font-size: 10px;
text-align: right;
}

.introjs-tooltipbuttons .introjs-skipbutton {
.introjs-button {
position: relative;
overflow: visible;
display: inline-block;
padding: 0.3em 0.8em;
border: 1px solid #d4d4d4;
margin: 0;
text-decoration: none;
text-shadow: 1px 1px 0 #fff;
font: 11px/normal sans-serif;
color: #333;
white-space: nowrap;
cursor: pointer;
outline: none;
background-color: #ececec;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f4f4f4), to(#ececec));
background-image: -moz-linear-gradient(#f4f4f4, #ececec);
background-image: -o-linear-gradient(#f4f4f4, #ececec);
background-image: linear-gradient(#f4f4f4, #ececec);
-webkit-background-clip: padding;
-moz-background-clip: padding;
-o-background-clip: padding-box;
/*background-clip: padding-box;*/ /* commented out due to Opera 11.10 bug */
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
border-radius: 0.2em;
/* IE hacks */
zoom: 1;
*display: inline;
margin-top: 10px;
}

.introjs-button:hover {
border-color: #bcbcbc;
text-decoration: none;
box-shadow: 0px 1px 1px #e3e3e3;
}

.introjs-button:focus,
.introjs-button:active {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ececec), to(#f4f4f4));
background-image: -moz-linear-gradient(#ececec, #f4f4f4);
background-image: -o-linear-gradient(#ececec, #f4f4f4);
background-image: linear-gradient(#ececec, #f4f4f4);
}

/* overrides extra padding on button elements in Firefox */
.introjs-button::-moz-focus-inner {
padding: 0;
border: 0;
}

.introjs-skipbutton {
margin-right: 5px;
color: gray;
color: #7a7a7a;
}

.introjs-tooltipbuttons .introjs-nextbutton {
font-size: 11px;
font-weight: bold;
color: #2071d3;
.introjs-prevbutton {
-webkit-border-radius: 0.2em 0 0 0.2em;
-moz-border-radius: 0.2em 0 0 0.2em;
border-radius: 0.2em 0 0 0.2em;
border-right: none;
}

.introjs-nextbutton {
-webkit-border-radius: 0 0.2em 0.2em 0;
-moz-border-radius: 0 0.2em 0.2em 0;
border-radius: 0 0.2em 0.2em 0;
}

0 comments on commit ed069c5

Please sign in to comment.