Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

fix: full width image will move together when scrolling [SPMVP-5751] #159

Merged
merged 3 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ watch(
},
)

const { left } = useElementBounding(root)
const { left, width } = useElementBounding(root)
const { render } = useRenderEditorBlock(editorBlocks)
const customFieldsKey = CUSTOM_FIELD_EDITOR_BLOCK_KEY
// @ts-expect-error internal untyped property
Expand Down Expand Up @@ -126,7 +126,7 @@ whenever(
</script>

<template>
<div ref="root" class="article-body" :style="{ '--left-offset': `${left}px` }">
<div ref="root" class="article-body" :style="{ '--left-offset': `${left}px`, '--body-width': `${width}px` }">
<div v-for="(segment, index) of articleSegments" :key="`${segment.id}-${index}`">
<AdvertisingSlot
v-if="segment.type === 'ad'"
Expand Down
2 changes: 1 addition & 1 deletion packages/karbon/src/runtime/assets/article-base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@apply px-0;

margin-left: calc(var(--left-offset, 0) * -1);
width: 100vw;
width: var(--body-width);
}

&.wide {
Expand Down