Dukaan Themes
  • Introduction to Dukaan Themes
  • Building your own custom theme
  • Getting the basics right
  • Making your first edit
  • Theme folder structure
  • How does it all work?
  • Nunjucks Templating Language
  • Basic code editing
    • Adding the HTML
    • Adding the CSS
    • Adding the Javascript
    • Adding Nunjucks
  • Customising Dukaan Templates
  • Dukaan Data
  • Advance code editing
    • Customising core functionality
  • Dukaan Functions
  • Integrating Dukaan Plugins
    • Wishlist plugin
    • Countdown timer plugin
    • Product scarcity plugin
  • Testing and Deploying Your Theme
  • Code Snippets
    • Changing text of Add to bag button
    • Adding shadow to product cards
    • Adding auto-scrolling text in homepage
Powered by GitBook
On this page

Was this helpful?

  1. Code Snippets

Adding auto-scrolling text in homepage

We will try to add a non-stop horizontal scrolling banner containing a brand name on the top of our store.

Open the layout.html page and the following HTML code to it just inside the body tag or anywhere as per your requirement

<div class="scroll">
  <div class="m-scroll">
    <span style="rbackground: cyan;">BRAND | BRAND | BRAND </span>
    <span style="rbackground: cyan;">BRAND | BRAND | BRAND </span>
    <span style="rbackground: cyan;">BRAND | BRAND | BRAND </span>
    <span style="rbackground: cyan;">BRAND | BRAND | BRAND </span>
    </div>
</div>

After this, open the layout.css file and add the following CSS to the file.

.scroll {
  position: relative;
  width: 100vw;
  height: 15%;
  background-color: #252525;
  overflow: hidden;
  z-index: 1;
  margin: 0;
  padding: 0;
}

.m-scroll {
  overflow: hidden;
  height: 100%;
  white-space: nowrap;
  animation: scrollText 10s infinite linear;
  margin: 0;
  font-size: 0;
  display: inline-block;
}

span {
  font-size: 50px;
  display: inline-block;
  min-width: 100vw;
  margin: 0;
  padding: 0;
  color: white;
}

@keyframes scrollText {
  from {
    transform: translateX(0%);
  }
  to {
    transform: translateX(-50%);
  }
}

Once you're done, you can deploy the changes and wait for them to reflect on your store page. This is how it would look like

PreviousAdding shadow to product cards

Last updated 2 years ago

Was this helpful?