Giter Site home page Giter Site logo

Comments (5)

bootstraponline avatar bootstraponline commented on May 7, 2024

Possible implementation:

diff --git a/source/javascripts/app/lang.js b/source/javascripts/app/lang.js
index 7f1bcdb..e5170ca 100644
--- a/source/javascripts/app/lang.js
+++ b/source/javascripts/app/lang.js
@@ -21,13 +21,14 @@ under the License.

   function activateLanguage(language) {
     if (!language) return;
-
     $("#lang-selector a").removeClass('active');
     $("#lang-selector a[data-language-name='" + language + "']").addClass('active');
     for (var i=0; i < languages.length; i++) {
       $(".highlight." + languages[i]).hide();
+      $(".desc." + languages[i]).hide();
     }
     $(".highlight." + language).show();
+    $(".desc." + language).show();
   }

   function setupLanguages(l) {

from slate.

bootstraponline avatar bootstraponline commented on May 7, 2024

I added this for the tutorial I'm working on. If there's a better way, I'd be interested to know.

from slate.

bootstraponline avatar bootstraponline commented on May 7, 2024

Updated implementation to use simple tags. I had to modify the CSS a bit because slate wasn't happy that the content existed inside a span.

from slate.

lord avatar lord commented on May 7, 2024

Hmm, I can take a closer look at this this week. I think if we make everything have the same class, that would be faster, since it means jQuery doesn't have to search over the entire page twice.

from slate.

lord avatar lord commented on May 7, 2024

In a similar way to the suggestion by @bootstraponline, we've ended up implementing a lang-specific class, which you can use like this:

<p class="lang-specific ruby shell">
only show for ruby and shell languages
</p>

To use this feature, you need to write HTML instead of markdown, but we expect that this will be a rare-enough feature that this is an okay compromise.

from slate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.