dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://hugoloveit.com
MIT License
3.38k stars 1.07k forks source link

Automatic expansion of the width of the right-hand side of the code #782

Open IlIIIIIIlI opened 1 year ago

IlIIIIIIlI commented 1 year ago

Is it possible to implement a function in the code area that can be expanded?

Something like mouse over the code area of markdown and once the slider is recognized it can be automatically expanded to the right.

PaperMod theme has this feature, but I prefer Loveit's layout and would like to know if this is possible, or if it is already possible.

<script>
  $("code[class^=language] ")
    .on("mouseover", function () {
      if (this.clientWidth < this.scrollWidth) {
        $(this).css("width", "135%");
      }
    })
    .on("mouseout", function () {
      $(this).css("width", "100%");
    });
</script>