Closed axar closed 6 years ago
@dpiccone Can this get merged 🙏 ?
Hi, can you replicate the issue in a plunkr/jsfiddle?
I don't understand how onload fits into the picture, this looks some sort of initialization code, which should be alredy taken care by the psOpen
binding.
Pretty much the DOM is added first and then the code runs which means if the code takes longer to run the slider is added the dom in it's open state (probably caused by the router). Then the initSlider code runs and it hides the slider, and causes an animation. By setting the slider to closed position (if required) ensures no late transitions.
If you set a break point on the example.js controller first line, you will see the slider remain open until watch is executed.
After spending couple of hours trying to replicate, I've failed to do so. It seems the watch
scope.$watch('psOpen', function(value) {
fires late, which leaves the slider open until. If the scope is really busy and the watch fires late should be able to replicate.
I have added a change here https://github.com/danielepiccone/ng-pageslide/commit/2fa5c299304386264577c272a22cf367c29296a1 that should address this problem and, consequently #171
The slider was appearing and disappearing on load if psOpen is marked as false on load.