usablica / intro.js

Lightweight, user-friendly onboarding tour library
http://introjs.com
Other
22.8k stars 2.59k forks source link

Width of introjs-helperLayer and introjs-tooltipReferenceLayer #706

Closed ivanbacher closed 7 years ago

ivanbacher commented 7 years ago

At the moment the width of these layers is about 5 px greater than the original bounding box of the element.

Is it possible to set the width to the exact size of the data-step/data-intro element?

screen_shot_2017-05-10_at_17_07_57

ivanbacher commented 7 years ago

https://github.com/usablica/intro.js/blob/master/intro.js#L742

Changing the following code seems to fix the issue.

helperLayer.setAttribute('style', 'width: ' + (elementPosition.width  + widthHeightPadding)  + 'px; ' +
                                        'height:' + (elementPosition.height + widthHeightPadding)  + 'px; ' +
                                        'top:'    + (elementPosition.top    - 5)   + 'px;' +
                                        'left: '  + (elementPosition.left   - 5)   + 'px;');

to

helperLayer.setAttribute('style', 'width: ' + (elementPosition.width)  + 'px; ' +
                                         'height:' + (elementPosition.height)  + 'px; ' +
                                         'top:'    + (elementPosition.top)   + 'px;' +
                                         'left: '  + (elementPosition.left)   + 'px;');

However, I am not sure if this will cause any other issues.

bozdoz commented 7 years ago

Shouldn't cause any other issues. It's just a style change/preference.

afshinm commented 7 years ago

I believe we have fixed this in the previous version.