Skip to content

Commit

Permalink
update promo js/css
Browse files Browse the repository at this point in the history
  • Loading branch information
progressbarsk committed Sep 9, 2012
1 parent ed8f612 commit ecd25a5
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 86 deletions.
25 changes: 1 addition & 24 deletions app/assets/javascripts/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
$(function() {
if (!Modernizr.input.placeholder) {
$('html').addClass('no-placeholder');
}

if (typeof $.scrollTo === 'function') {
$('a.scroll').bind('click', function () {
var a = $(this),
scroll_to = $(a.attr('href'));
if (scroll_to.length > 0) {
$.scrollTo(scroll_to, 1000);
}

return false;
});
}

if (typeof $.fancybox === 'function') {
$('a.lightbox').fancybox({
'titlePosition': 'inside'
});
}

});
$('html').removeClass('no-js').addClass('js');
91 changes: 44 additions & 47 deletions app/assets/javascripts/promo.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,61 @@
$(function() {
var promo = $('#promoss');
var promo = $('#promo'),
promo_cnt = $('#promo-content'),
promo_nav = $('#promo-nav'),
promo_items = [], promo_active_item = null, promo_auto_animate = true, promo_timer = null;

if (promo.length > 0) {
var promo_cnt = $('#promo-content'),
promo_nav = $('#promo-nav'),
promo_items = promo.find('.promo-item'),
promo_active_item = null,
promo_auto_animate = true,
promo_timer = null,
loc_hash = document.location.hash;

if (promo.find(loc_hash).length === 0) {
function promoAnimate() {
promo_items.each(function () {
var elm = $(this),
promo_items = promo.find('.promo-item');

promo_nav.delegate('a', 'click', function () {
clearTimeout(promo_timer);
promo_auto_animate = false;
promo_active_item = $($(this).attr('href')).get(0);
promoAnimate();
return false;
});

function promoAnimate() {
promo_items.each(function () {
var elm = $(this),
elm_anchor = promo_nav.find('a[href|="#' + this.id + '"]');

if (this.id != promo_active_item.id) {
elm.removeClass('active');
elm_anchor.removeClass('active');
elm.fadeTo('normal', 0.3);
} else {
elm.addClass('active');
elm_anchor.addClass('active');
elm.fadeTo('normal', 1);
}
});
}

promo_nav.delegate('a', 'mouseover', function () {
clearTimeout(promo_timer);
promo_auto_animate = false;
promo_active_item = $($(this).attr('href')).get(0);
promoAnimate();
if (this.id != promo_active_item.id) {
elm.removeClass('active');
elm_anchor.removeClass('active');
elm.fadeTo('normal', 0.3);
} else {
elm.addClass('active');
elm_anchor.addClass('active');
elm.fadeTo('fast', 1);
}
});
}

function promoAnimateTimer () {
promo_timer = setTimeout(function () {
if (promo_auto_animate && promo_active_item !== promo_items.last()) {
var active_index = promo_active_item ? promo_items.index(promo_active_item) : -1;
promo_active_item = promo_items.get(active_index + 1);
function promoAnimateTimer () {
var last_item = promo_items.last();
promo_timer = setTimeout(function () {
if (promo_auto_animate && promo_active_item !== last_item) {
var active_index = promo_active_item ? promo_items.index(promo_active_item) : -1;
promo_active_item = promo_items.get(active_index + 1);

if (promo_active_item) {
promoAnimate();
promoAnimateTimer();
} else {
clearTimeout(promo_timer);
promo_auto_animate = false;
}
if (promo_active_item) {
promoAnimate();
promoAnimateTimer();
} else {
clearTimeout(promo_timer);
promo_auto_animate = false;
}
}, promo_active_item ? 4000 : 10);

return false;
}
} else {
clearTimeout(promo_timer);
promo_auto_animate = false;
}
}, promo_active_item ? 4000 : 10);

// promoAnimateTimer();
return false;
}

promoAnimateTimer();
}

});
13 changes: 5 additions & 8 deletions app/assets/stylesheets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@

#promo {
position: relative;
clear: both;
}

#promo-content {
Expand Down Expand Up @@ -147,6 +146,8 @@
text-shadow: 0px 1px 0px #ccc;
}

.js .promo-item { display: none; position: absolute; }

.promo-item {
background: #000;
overflow: hidden;
Expand All @@ -158,11 +159,6 @@
border-radius: 3px;
}

.js .promo-item {
/* display: none;*/
/* position: absolute;*/
}

.promo-text {
padding: 32px;
font-size: 24px;
Expand All @@ -179,8 +175,9 @@
}

.promo-item-2 .promo-text {
bottom: 310px;
bottom: 280px;
left: 0px;
top: 0px;
width: 100%;
}

Expand All @@ -193,7 +190,7 @@
.promo-item-4 .promo-text {
bottom: 50px;
left: 225px;
width: 540px;
width: 520px;
font-size: 17px;
}

Expand Down
7 changes: 4 additions & 3 deletions db/templates/home_perex_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
We are regularly held interesting lectures, <br />
workshops and meetings of various communities.
</p>
<br />
<p>
Most of events organized at the hackerspace <br />
are open for public and for free. <br>
You are welcome visit to us!
Most of events organized at the hackerspace
are open for public&nbsp;and&nbsp;for free.
<b>You are welcome visit to us!</b>
</p>
</div>
</div>
Expand Down
7 changes: 3 additions & 4 deletions db/templates/home_perex_sk.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
Pravidelne sa u nás konajú zaujímavé prednášky, <br />
workshopy a stretnutia rôznych komunít.
</p>
<p>
Snažíme sa byť maximálne otvorení a vítame nových aktívnych členov, <br />
prídite na jednu z našich stretávok alebo akcií. <br />
Väčšina akcií Progressbaru je zadarmo.
<p><br />
Väčšina akcií Progressbaru je <b>zadarmo a otvorené pre všetkých</b>,
neváhajte prísť na niektorú z našich akcií.
</p>
</div>
</div>
Expand Down

0 comments on commit ecd25a5

Please sign in to comment.