Skip to content

Commit a4918d8

Browse files
committed
Added ability to add clickable image on walkthrough, if want to explain something more visual and to have an event if clicked, to redirect, for example
1 parent 1492c9a commit a4918d8

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,15 @@ and use one of the two configurations:
130130
- `icon` (optional) - Any walkthrough type. If set to any of the predefined values ("single_tap", "double_tap", "swipe_down", "swipe_left", "swipe_right", "swipe_up"), in such case the icon will be bound to focus element (if exists), make sure to add 'ng-walkthrough.tap_icons.js' following instructions above. any other icon can be used and will be loaded from supplied folder
131131
- `main-caption` (optional) - Any walkthrough type. This is the text that will be displayed in the walk-through. Text can be formatted
132132
- `use-button` (optional) - Any walkthrough type. set to 'true' you want a button displayed that most be clicked in order to close walkthrough, otherwise clicking anywhere while walkthrough displayed will close it
133+
- `walkthrough-hero-image` (optional) - Any walkthrough type. Image to display in walkthrough rigth below caption text
133134
- `icon-padding-left` (optional) - Any walkthrough type. Add padding to the icon from the left in percentage
134135
- `icon-padding-top` (optional) - Any walkthrough type. Add padding to the icon from the top in pixels
135136
- `tip-icon-location` (optional) - For tip walkthrough. In case there is an overlap between the tip text box and the tip icon you can define here which is on top. Either "FRONT" or "BACK"
136137
- `force-caption-location` (optional) - Any walkthrough type. Set caption location at the top of screen or closer to bottom. Acceptable values: "TOP" or "BOTTOM"
137138
- `tip-color` (optional) - For tip walkthrough. Define the tip textbox background color. Currently supports "BLACK" or "WHITE" values
138139
- `on-walkthrough-show` (optional) - Any walkthrough type. Bind method to be called when walkthrough is displayed
139140
- `on-walkthrough-hide` (optional) - Any walkthrough type. Bind method to be called when walkthrough is hidden
141+
- `on-walkthrough-content-clicked` (optional) - Any walkthrough type. Bind method to be called when walkthrough context or hero image clicked
140142

141143
## Testing
142144

css/ng-walkthrough.css

+4
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,7 @@
201201
background-color: #ffffff;
202202

203203
}
204+
205+
.walkthrough-hero-image{
206+
margin-top: 15px;
207+
}

ng-walkthrough.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ angular.module('ng-walkthrough', [])
2929
'<div class="walkthrough-text-container" ng-class="{\'walkthrough-top\': (!forceCaptionLocation || forceCaptionLocation==\'TOP\'), \'walkthrough-bottom\': forceCaptionLocation==\'BOTTOM\'}">',
3030
'<pre class="walkthrough-element walkthrough-text" ng-bind="mainCaption">',
3131
'</pre>',
32+
'<img ng-if="walkthroughHeroImage" class="walkthrough-element walkthrough-hero-image" ng-src="{{walkthroughHeroImage}}" ng-click="onWalkthroughContentClicked()">',
3233
'</div>',
3334
'<img class="walkthrough-element walkthrough-icon" ng-show="icon && icon!=\'arrow\'" ng-src="{{walkthroughIcon}}">',
3435
'<div class="walkthrough-element walkthrough-arrow" ng-show="icon==\'arrow\'"></div>',
@@ -44,9 +45,10 @@ angular.module('ng-walkthrough', [])
4445
'<button class="walkthrough-done-button walkthrough-tip-done-button-text-box" type="button" ng-if="useButton" ng-click="onCloseClicked($event)" on-touch="onCloseTouched($event)">',
4546
'<img class="walkthrough-tip-button-image-text-box" ng-src="{{closeIcon}}" alt="x">',
4647
'</button>',
47-
'<div class="walkthrough-element walkthrough-tip-text-box" ng-class="{\'walkthrough-tip-text-box-color-black\': tipColor==\'BLACK\', \'walkthrough-tip-text-box-color-white\': tipColor==\'WHITE\'}">',
48+
'<div class="walkthrough-element walkthrough-tip-text-box" ng-click="onWalkthroughContentClicked()" ng-class="{\'walkthrough-tip-text-box-color-black\': tipColor==\'BLACK\', \'walkthrough-tip-text-box-color-white\': tipColor==\'WHITE\'}">',
4849
'<pre ng-bind="mainCaption">',
4950
'</pre>',
51+
'<img ng-if="walkthroughHeroImage" class="walkthrough-element walkthrough-hero-image" ng-src="{{walkthroughHeroImage}}">',
5052
'<div class="'+ DOM_TRANSCLUDE + '"></div>',
5153
'</div>',
5254
'</div>',
@@ -74,12 +76,14 @@ angular.module('ng-walkthrough', [])
7476
hasBackdrop: '=?',
7577
hasGlow: '=?',
7678
useButton: '=?',
79+
walkthroughHeroImage: '@?',
7780
iconPaddingLeft: '@?',
7881
iconPaddingTop: '@?',
7982
tipIconLocation: '@?',
8083
tipColor: '@?',
8184
onWalkthroughShow: '&',
82-
onWalkthroughHide: '&'
85+
onWalkthroughHide: '&',
86+
onWalkthroughContentClicked: '&'
8387
},
8488
link: function (scope, element, attrs, ctrl, $transclude) {
8589
var getIcon = function(icon){

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng-walkthrough",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"homepage": "https://github.com/souly1/ng-walkthrough",
55
"authors": [
66
"Ophir Stern <souly01@gmail.com>"

0 commit comments

Comments
 (0)