@@ -13,6 +13,7 @@ import ContentTypeConfigInterface from "../../content-type-config.d";
13
13
import ConditionalRemoveOption from "../../content-type-menu/conditional-remove-option" ;
14
14
import { OptionsInterface } from "../../content-type-menu/option.d" ;
15
15
import ContentTypeInterface from "../../content-type.d" ;
16
+ import DataStore from "../../data-store" ;
16
17
import ContentTypeMountEventParamsInterface from "../content-type-mount-event-params.d" ;
17
18
import ContentTypeReadyEventParamsInterface from "../content-type-ready-event-params.d" ;
18
19
import ObservableUpdater from "../observable-updater" ;
@@ -35,7 +36,8 @@ export default class Preview extends PreviewCollection {
35
36
// Destroy all instances of the plugin prior
36
37
try {
37
38
// store/apply correct style after destroying, as jarallax incorrectly overrides it with stale value
38
- const style = this . element . getAttribute ( "style" ) ;
39
+ const style = this . element . getAttribute ( "data-jarallax-original-styles" ) ||
40
+ this . element . getAttribute ( "style" ) ;
39
41
jarallax ( this . element , "destroy" ) ;
40
42
this . element . setAttribute ( "style" , style ) ;
41
43
} catch ( e ) {
@@ -47,10 +49,10 @@ export default class Preview extends PreviewCollection {
47
49
jarallax (
48
50
this . element ,
49
51
{
50
- imgPosition : this . data . main . style ( ) . backgroundPosition || "50% 50%" ,
51
- imgRepeat : this . data . main . style ( ) . backgroundRepeat === "0" ? "no- repeat" : " repeat",
52
- imgSize : this . data . main . style ( ) . backgroundSize || "cover" ,
53
- speed : this . data . main . attributes ( ) [ "data-parallax-speed" ] || 0.5 ,
52
+ imgPosition : this . parent . dataStore . get ( "background_position" ) as string || "50% 50%" ,
53
+ imgRepeat : this . parent . dataStore . get ( "background_repeat" ) as " repeat" | "no- repeat",
54
+ imgSize : this . parent . dataStore . get ( "background_size" ) as string || "cover" ,
55
+ speed : Number . parseFloat ( this . parent . dataStore . get ( "parallax_speed" ) as string ) || 0.5 ,
54
56
} ,
55
57
) ;
56
58
jarallax ( this . element , "onResize" ) ;
0 commit comments