Skip to content

Instantly share code, notes, and snippets.

@leopic
Created February 12, 2013 20:29
Show Gist options
  • Select an option

  • Save leopic/4773095 to your computer and use it in GitHub Desktop.

Select an option

Save leopic/4773095 to your computer and use it in GitHub Desktop.
diff --git a/css/style.css b/css/style.css
index 8d76252..3ce66b3 100644
--- a/css/style.css
+++ b/css/style.css
@@ -74,9 +74,9 @@ h1,h2,h3,h4 { font-family:Helvetica,Arial,sans-serif; text-transform:uppercase;
/* Shop */
#shop { padding:20px 0 40px; text-align:left; }
- #shop.blur { height:250px; }
- #shop.blur:hover { height:290px; transition:height .3s; -webkit-transition:height .3s; }
- #shop.focus { height:auto; }
+ /*#shop.blur { height:250px; }
+ /*#shop.blur:hover { height:290px; -transition:height .3s; }
+ #shop.focus { height:auto; }*/
.featured-categories { text-align:center; }
.featured-categories ul { display:block; padding:0; }
@@ -101,4 +101,8 @@ h1,h2,h3,h4 { font-family:Helvetica,Arial,sans-serif; text-transform:uppercase;
-
\ No newline at end of file
+/* Rules by Leo */
+.alpha { background: red; }
+#shop.blur { height: 250px; }
+#shop.halfway { height: 305px; }
+#shop.expanded { height: 500px; }
diff --git a/js/init.js b/js/init.js
index 5563c2d..d45e626 100644
--- a/js/init.js
+++ b/js/init.js
@@ -1,11 +1,23 @@
-$('#shop.blur').hover(function(){
- $(this).animate({height: 290}, 500);
-}, function(){
- $(this).animate({height: 250}, 500);
-});
+$(document).ready(function() {
+ var dDuration = 500,
+ dEasing = 'easeInExpo';
+
+ // toggleClass adds the class if it's not there and removes it if it was
+ $('.more').click(function(event) {
+ $(this).toggleClass('container-expanded');
+ $('#shop').toggleClass('expanded', dDuration, dEasing);
+ event.preventDefault();
+ });
+
+ // Play with halfway class only if #shop is not expanded
+ if ($('#shop').hasClass('expanded') === false) {
+ $('#shop').hover(function() {
+ $('#shop').addClass('halfway', dDuration, dEasing);
+ }, function() {
+ $('#shop').removeClass('halfway', dDuration, dEasing);
+ });
+ }
+
-$('.more').click(function(){
- $('#shop.blur').switchClass('blur', 'focus', 2000, 'easeInOutBack');
- $('#shop.focus').switchClass('focus', 'blur', 2000, 'easeInOutBack');
- return false;
});
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment