Pen Settings



CSS Base

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!-- Use preprocessors via the lang attribute! e.g. <template lang="pug"> -->
  <div id="app">
    <section class="_spacer"></section>
    <section class="_section__slider-option">
      <div class="_media"></div>
      <div ref="sliderContent" class="_slider__content">
        <div class="_card--raised">
          <div class="_card__wrapper" id="card1">Card 1</div>
        <div class="_card--raised">
          <div class="_card__wrapper" id="card2">Card 2</div>
    <section class="_spacer"></section>

export default {
  name: "SliderOption",
  data() {
    return {
      sliderOptionTL: undefined
  methods: {
    initSliderOption() {
      const sliderContent = this.$refs.sliderContent;
      const slides = gsap.utils.toArray(

      if (this.sliderOptionTL) {
        console.log("Kill Tweens");
      this.sliderOptionTL = gsap.timeline({
        paused: true,
        scrollTrigger: {
          trigger: slides,
          start: "top 50%",
          toggleActions: "play auto auto reverse",
          markers: true
      //this.sliderOptionTL.set(slides, { clearProps: "all" });, {
        x: this.posX,
        ease: "power1.inOut",
      });"#card1", { opacity: 0.4 }, "-=0.5");
      this.sliderOptionTL.from("#card2", { opacity: 0.4 }, "-=0.5");
    onResize() {
  computed: {
    posX() {
      const sliderContent = this.$refs.sliderContent;
      const posX = sliderContent.offsetWidth - sliderContent.scrollWidth;
      console.log("posX ::: ", posX);
      return posX;
  mounted() {
    window.addEventListener("resize", this.onResize);
  beforeDestroy() {
    console.log("SliderOption Destroyed");

<!-- Use preprocessors via the lang attribute! e.g. <style lang="scss"> -->
<style lang="scss">
* {
  margin: 0;
  padding: 0;
  font-size: 25px;
._spacer {
  height: 60vh;
._section__slider-option {
  border: 1px solid red;
._slider__content {
  display: grid;
  grid-template-columns: repeat(2, 80%);
  grid-template-rows: 250px;
  overflow: hidden;
._card__wrapper {
  height: 100%;
  background-color: green;