Explorar el Código

Exercise 4.2: Yellow hovers.

Frederic G. MARAND hace 8 años
padre
commit
37e4931702
Se han modificado 2 ficheros con 9 adiciones y 0 borrados
  1. 4 0
      Chapter 4/04.js
  2. 5 0
      Chapter 4/04.scss

+ 4 - 0
Chapter 4/04.js

@@ -65,4 +65,8 @@ $(document).ready(function () {
   $('p').eq(3).css('backgroundColor', '#ccc').hide();
 
   $('body').fadeTo(2000, 1);
+
+  $('p').hover(function () {
+    $(this).toggleClass('highlighted');
+  });
 });

+ 5 - 0
Chapter 4/04.scss

@@ -2,6 +2,7 @@ $black: #000;
 $white: #fff;
 $darkfg: #06581f;
 $medium: #777;
+$highlight: #ff0;
 
 /***************************************
    Default Styles
@@ -55,9 +56,13 @@ a {
   padding: .5em;
   border: 1px solid $medium;
 }
+
 .label {
   width: 130px;
   margin: .5em 0;
   cursor: pointer;
 }
 
+.highlighted {
+  background-color: $highlight;
+}