• Start
      • Back
      • Blog
      • Joomla 3 - administracja
      • Joomla 4 - administracja
      • Wordpress - administracja
      • Code Combat
      • Joomla czy Wordpress
      • Polityka prywatności
  • Portfolio
  • Strony internetowe
      • Back
      • Aktualizacje i szkolenia
      • Strony Responsywne
      • Jak pracuję
      • CMS Joomla
      • Pozycjonowanie strony
      • Hosting

Codecombat - eventful selectors - JavaScript

Szczegóły
09 sierpień 2020
2208

<!-- It is possible to find which element was selected. -->
<!-- Using $(this) in an event function does just that. -->
<!-- var elm = $(this) sets elm to the clicked element. -->

<script>
    li = $("li");
    function toggleStriked() {
        $(this).toggleClass("striked");
    }
    li.on("click", toggleStriked);
    
    h2 = $("h2"); // This sets h2 to all h2 elements.
    function toggleBold() {
        // $() also accepts 'this' as an argument.
        // 'this', when inside of an event function is...
        // ... the specific target for the event!
        // Look at "toggleStriked" for an example.
        // Toggle the class "bold" on the clicked h2:
            $(h2).toggleClass("bold");
    }
    // When any h2 is clicked, perform "toggleBold".
    h2.on("click", toggleBold);
</script>
<style>
    .bold {
        font-weight:bold;
        font-size:xx-large;
    }
    .striked {
        text-decoration:line-through;
    }

Więcej…

Codecombat - sibling rivalry - rywalizujące rodzeństwo - JavaScript

Szczegóły
09 sierpień 2020
2032

<!-- To select neighboring elements, use "siblings()" -->
<!-- Use this to unfocus elements next to a target. -->
<!-- Elements are neighbors when at similar identation. -->

<script>
    var selectable = $(".selectable");
    function focusSelected() {
        var targetElement = $(this);
        var siblings = targetElement.siblings();
        siblings.addClass("mute");
        // Use removeClass() to remove "sel" from siblings.
        siblings.removeClass("sel");
        targetElement.removeClass("mute");
        // Use addClass() to add "sel" to targetElement.
        targetElement.addClass("sel");
    }
    selectable.on("click", focusSelected);
</script>
<style>
    .selectable {
        /* This makes the element transparent. */
        cursor: pointer;
        background-color:gray;
    }
    .sel {
        background-color:green;
    }
    .mute {
        /* This makes the element transparent. */
        opacity:0.1;
    }
    body {
        text-align:center;
    }
</style>

Więcej…

Codecombat - border patrol - patrol graniczny - JavaScript

Szczegóły
09 sierpień 2020
2083

<!-- Time to dive deeper into more CSS properties.  -->
<!-- Borders can be added to surround elements. -->

<style>
    /* Remember to select a class, use a "." */
    .content {
        /* To add a default border, add a border-style. */
        /* Border styles can be: solid, dotted, ... */
        /* ... inset, double, groove, ridge, outset */
        border-style:double;
    }

Więcej…

Codecombat - marginal utility - JavaScript

Szczegóły
09 sierpień 2020
1983

<!-- Margin and Padding are used to layout elements. -->
<!-- Margin is the space between elements. -->
<!-- Padding is distance between the content and... -->
<!-- ... edge of an element. -->

<style>
    body {
        text-align:center;
    }
    img {
        border:1px black solid;
    }

Więcej…

Codecombat - random riposte - losowa riposta - JavaScript

Szczegóły
08 sierpień 2020
2233

// Use game.randomInteger(min,max) to add randomness!
game.spawnPlayerXY("knight", 40, 35);
game.addSurviveGoal();
game.addDefeatGoal(8);

function onSpawn(event) {
    while(true) {
        var unit = event.target;
        var enemy = unit.findNearestEnemy();
        if(enemy) {
            unit.attack(enemy);
        }
    }
}

Więcej…

Codecombat - query confirmed - potwierdzone pytanie

Szczegóły
08 sierpień 2020
2093

<!-- The <script> tag lets you add JavaScript! -->
<!-- The browser can only read JavaScript, not Python! -->

<script>
    // -JavaScript should be written inside <script> tags.
    // CodeCombat uses jQuery to make JavaScript easier.
    // jQuery is a function, like moveLeft().
    // Except instead of "moveLeft()", it's just: "$()"
    // Finds #theImage.
    var image = $("#theImage");
    // Setting the image's "background-color" to "red".

Więcej…

Codecombat - clickthrough - przeklikaj - JavaScript

Szczegóły
08 sierpień 2020
2182

<!-- It is possible to make your website interactive! -->
<!-- jQuery includes ".on()" to watch for events. -->
<!-- The "click" occurs when an element is clicked. -->

<script>
    // Remember only JavaScript goes inside <script> tags.
    // This sets the button's text color to "blue".
    var button = $("#theButton");
    

Więcej…

Codecombat - adventure time - Czas na przygodę - JavaScript

Szczegóły
08 sierpień 2020
2027

// game.time to czas ,który upłyną  w grze.
game.spawnPlayerXY("guardian", 10, 35);
game.addSurviveGoal();
game.addDefeatGoal(5);

function onSpawn(event) {
    while(true) {
        var unit = event.target;
        var enemy = unit.findNearestEnemy();
        if(enemy) {
            unit.attack(enemy);
        }
    }
}

Więcej…

Strona 13 z 27

  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • Strony internetowe Lublin
  • Strony internetowe Puławy
  • Strony www Puławy
  • Strony www Lublin
  • Strony responsywne Lublin
wykonanie: kasai1.com