How SC Catalog item widget is been automatically scrolled when we scroll down in our bowser window

Ashwin Perumal1
Tera Contributor

Hello @Ankur Bawiskar 
I am submitting a request from my employee center portal and i notice the Order Now button at right side of my catalog form. When I scroll the page down below to fill my catalog form my Order Now button widget(SC Catalog item-widget name) also been scrolled down till my catalog form page . I want to understand how that widget is scrolling down when i scroll down in my page. 
In below image you can see position of order now button widget at top before scrolling down

AshwinPerumal1_0-1704884838412.png

 

 

Now after scrolling down the page my widget is also scrolling down along form

AshwinPerumal1_1-1704884838384.png

 

 

Can you please  guide me on this how this widget scrolling action is taking place. I am checking on css and html code of widget but couldn't get it. Can you please share your inputs on it. Thanks in advance

2 ACCEPTED SOLUTIONS

Peter Bodelier
Giga Sage

Hi @Ashwin Perumal1 

 

It's handled by CSS:

 

 

  <div ng-class="{true:'sc-fixed', false:'' }[isSCCartFixed]">
.sc-fixed {
			position: fixed;
			max-height: 100%;
			width: 17.67777%;
			z-index: 1;
			}

 

An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

Iraj Shaikh
Mega Sage
Mega Sage

Hi @Ashwin Perumal1 

 

The behavior you're describing, where the "Order Now" button scrolls along with the page, is typically achieved using a CSS property called 'position: fixed;' or 'position: sticky;'. These properties allow an element to be positioned in a specific way relative to the viewport, which means it can stay in the same place on the screen even when the page is scrolled.

Here's a brief explanation of both:

  1. position : fixed;

    • This CSS property is used to position an element relative to the browser window. It will not move when the page is scrolled, which means it will always stay in the same place on the screen.
    • Example CSS:

 

.fixed-button {
  position: fixed;
  top: 100px; /* Distance from the top of the viewport */
  right: 20px; /* Distance from the right of the viewport */
}

 

 
  • position: sticky;

    • This property is a hybrid of relative and fixed positioning. The element is treated as position: relative until the page is scrolled to a certain point, at which it becomes fixed.
    • Example CSS:

 

.sticky-button {
  position: -webkit-sticky; /* For Safari */
  position: sticky;
  top: 100px; /* Trigger point for sticky behavior */
  right: 20px;
}

 

Note that 'position: sticky;' will only work if the element's parent does not have an overflow value other than visible.

I tried to inspect the Order Now button widget by using the browser's developer tools by following the steps below

  1. Right-click on the "Order Now" button in your browser and select "Inspect" or "Inspect Element" from the context menu.
  2. Looked for the styles applied to the element in the Styles pane of the developer tools.

In CSS rules, I found that position: fixed is applied on the right side cart widget. Please refer the screenshot below
Screenshot 2024-01-11 at 1.40.27 PM.png

 

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

5 REPLIES 5

Hi Iraj,

Thanks Iraj, yeah I too saw it could find only for string fields. Is there any OOB examples or documentation available for using synchronized text field. I have a requirement to populate knowledge article based on category field(select box) field in my record producer. Currently using client scripts I am copying my choice field values to string field and populating knowledge articles and I am looking for an alternate option to directly populate articles based on choice field. Is there any examples of synchronized text fields or documentation. Thanks in advance.