Commit c74b58d5 authored by Eric Clouzet's avatar Eric Clouzet
Browse files

modify js to improve the view #14

parent 95f18e89
Showing with 26 additions and 26 deletions
+26 -26
......@@ -5,29 +5,29 @@ function go() {
$('img.eg_media').css({opacity: 0});
fitimg();
$('.tweet').css('padding-top', ((parseInt($('body').height()) - parseInt($('.tweet').height())) / 2) + 'px');
$('#user').animate({opacity: 1, marginLeft: '0'}, 500);
$('.avatar').animate({opacity: 1}, 500);
$('#time').animate({opacity: 1}, 500);
$('#user').animate({opacity: 1, marginLeft: '0'}, 1000);
$('.avatar').animate({opacity: 1}, 750);
$('#time').animate({opacity: 1}, 1000);
$('.tweet').animate({opacity: 1}, 500);
$('.tweet').animate({opacity: 1}, 100);
$('#content p').animate({opacity: 1}, 500, function () {
$('#content p').animate({opacity: 1}, 5000, function () {
fitimg();
});
$('.instagram img').animate({opacity: 1, marginLeft: '20%'}, 500, function () {
$('.instagram img').animate({opacity: 1, marginLeft: '20%'}, 750, function () {
fitimg();
});
window.setTimeout(function() { getItems() }, refresh_delay);
}
function out(item) {
$('#user').animate({opacity: 0, marginLeft: '1em'}, 1000);
$('.avatar').animate({opacity: 0}, 1000);
$('#time').animate({opacity: 0, bottom: 0}, 1000);
$('#content p,#content img').animate({opacity: 0}, 1000);
$('.tweet').animate({opacity: 0}, 1000);
$('.instagram img').animate({opacity: 0, marginLeft: '40%'}, 1000);
window.setTimeout(function() { display(item); go() }, 5000);
function out(item, first_call) {
$('#user').animate({opacity: 0, marginLeft: '1em'}, 750);
$('.avatar').animate({opacity: 0}, 750);
$('#time').animate({opacity: 0, bottom: 0}, 750);
$('#content p,#content img').animate({opacity: 0}, 750);
$('.tweet').animate({opacity: 0}, 750);
$('.instagram img').animate({opacity: 0, marginLeft: '40%'}, 750);
window.setTimeout(function() { display(item); go() }, first_call===null ? 7000 :0);
}
function fitimg() {
$('img.eg_media').each(function () {
......@@ -36,16 +36,16 @@ function fitimg() {
ho = $('html').height() - img_offset.top - 20;
if (ho < 50)
ho = 50;
$(this).animate({opacity: 1, height: ho + 'px', width: 'auto'}, 500);
$(this).animate({opacity: 1, height: ho + 'px', width: 'auto'}, 750);
}
else if (img_offset.left + $(this).width() > $('html').width()) {
wi = $('html').width() - img_offset.left - 30;
if (wi < 50)
wi = 50;
$(this).animate({opacity: 1, width: wi + 'px', height: 'auto'}, 500);
$(this).animate({opacity: 1, width: wi + 'px', height: 'auto'}, 750);
}
else {
$(this).animate({opacity: 1}, 500);
$(this).animate({opacity: 1}, 750);
}
});
}
......@@ -70,7 +70,7 @@ function display(item) {
$(body).find('#texto').addClass('no_media');
}
$('.slider-page__title').css('content', '('+item.media_url+')');
//$(body).find('#texto').text(content);
$('#texto').text(content);
//$(body).find('#texto_new').text(content);
//$(body).find('#texto_new2').text(content);
//$(body).find('#texto_new3').text(content);
......@@ -79,7 +79,7 @@ function display(item) {
}
$(document).ready(function () {
getItems();
getItems(true);
if ($('#eg_slide').length > 0 || $('#eg_pix').length > 0) {
$('img.eg_media').css({opacity: 0});
fitimg();
......@@ -112,19 +112,19 @@ $(document).ready(function () {
});
function getItems( datas = null ) {
function getItems( first_call = null ) {
var datas = {};
datas.type = "LIVEWALL";
if (!datas) {
var datas = {};
datas.type = "LIVEWALL";
}
$.ajax({
url: domain_stat + "ajax.php",
data: datas
})
.done(response => {
var item = JSON.parse(response)[0];
out(item);
out(item, first_call);
})
.fail(error => {
console.error(error);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment