Best Before « visit
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Best Before - http://bestbefore.ro
$.clientCoords = function() {
var dimensions = {width: 0, height: 0};
if (document.documentElement) {
dimensions.width = document.documentElement.offsetWidth;
dimensions.height = document.documentElement.offsetHeight;
}
else{
if (window.innerWidth && window.innerHeight) {
dimensions.width = window.innerWidth;
dimensions.height = window.innerHeight;
}
}
return dimensions;
}
function set_line_position(){
var dl_top = $("#mm_ichr").offset().top+$("#mm_ichr").height()/2-5;
var dl_left = $("#mm_ichr").offset().left+14+8;
$("#dline").css("top",dl_top+"px");
$("#dline").css("left",dl_left+"px");
}
function handleSliderChange(e, ui){
var maxScroll = $("#sm_scrollc").attr("scrollHeight") - $("#sm_scrollh").height();
var top_pos = ui.value * (maxScroll / 100);
$("#sm_scrollc").css({top: -(maxScroll-top_pos) });
}
function handleSliderSlide(e, ui){
var maxScroll = $("#sm_scrollc").attr("scrollHeight") - $("#sm_scrollh").height();
var top_pos = ui.value * (maxScroll / 100);
$("#sm_scrollc").css({top: -(maxScroll-top_pos) });
}
function handleSliderChange1(e, ui){
var maxScroll = $("#cm_scrollc").attr("scrollHeight") - $("#cm_scrollh").height();
var top_pos = ui.value * (maxScroll / 100);
$("#cm_scrollc").css({top: -(maxScroll-top_pos) });
}
function handleSliderSlide1(e, ui){
var maxScroll = $("#cm_scrollc").attr("scrollHeight") - $("#cm_scrollh").height();
var top_pos = ui.value * (maxScroll / 100);
$("#cm_scrollc").css({top: -(maxScroll-top_pos) });
}
function load_content(url,file,cclass,type){
is_active = 1;
var content = "";
hide_content();
$("#content").load('content/'+file+'?r='+Math.floor(Math.random()*11), function(data){
$(url).parent().addClass("sel");
var ww = $.clientCoords().width;
var wh = $.clientCoords().height;
var mm_w = $("#mm").width()+28;
var dline_w = $("#dline").width()+16;
var sm_w = $("#sm."+cclass).width()+28;
var cm_w = 0;
var plus_w = 0;
if (type!=2){
cm_w = $("#cm."+cclass).width()+28;
plus_w = $("#plus").width()+9;
if (type==1) cm_w = $("#cl."+cclass).width()+28;
}
var content_width = mm_w+dline_w+sm_w+plus_w+cm_w;
var icontent_width = sm_w+plus_w+cm_w;
var mm_h = $("#mm").height();
var sm_h = $("#sm."+cclass).height();
var cm_h = 0;
if (type!=2){
cm_h = $("#cm."+cclass).height();
if (type==1) cm_h = $("#cl."+cclass).height();
}
var content_height = 0;
if (cm_h>mm_h || sm_h>mm_h){
content_height = Math.max(cm_h,sm_h)+114;
}
else{
content_height = mm_h;
}
var c_pos_top = Math.round((wh-content_height)/2)>30?Math.round((wh-content_height)/2):30;
var c_pos_left = Math.round((ww-content_width)/2);
var offset = 0;
var mm_pos_top = c_pos_top;
var mm_pos_left = c_pos_left;
var is_smm = 0;
if (content_width>(ww-60)){
offset = content_width - icontent_width;
c_pos_left = Math.round((ww-icontent_width)/2);
mm_pos_left = ((c_pos_left)>30?c_pos_left:30)-offset+28;
$("#sm."+cclass).append('<div id="sm_menu"><a href="#">MENIU</a></div>');
is_smm = 1
}
$("#mm").animate({top:mm_pos_top,left:mm_pos_left},function(){
set_line_position();
$("#dline").css({visibility: "visible", display: "none"})
$("#dline").animate({"width":"toggle"},500,function(){
var dl_top = $("#mm_ichr").offset().top+$("#mm_ichr").height()/2-79;
var dl_left = $("#mm_ichr").offset().left+14+8+$("#dline").width()+8+8;
$("#sm").css("top",dl_top+"px");
$("#sm").css("left",dl_left+"px");
$("#sm").css({visibility: "visible", display: "none"})
$("#sm").fadeIn(function(){
if ($("#sm_scrollc").height()>$("#sm_scrollh").height()){
$("#sm_content").append('<div id="slider"> </div>');
$("#slider").fadeIn(function(){
$("#slider").slider({
orientation: 'vertical',
animate: 'true',
value: 100,
change: handleSliderChange,
slide: handleSliderSlide
});
});
}
if (is_smm==1){
$("#sm_menu").fadeIn();
}
if (type!=2){
$("#plus").css("top",dl_top+50+"px");
$("#plus").css("left",dl_left+($("#sm").width()+23)+"px");
$("#plus").css({visibility: "visible", display: "none"})
$("#plus").fadeIn(function(){
var c = "cm";
if (type==1) c = "cl";
$("#"+c).css("top",dl_top+"px");
$("#"+c).css("left",dl_left+$("#sm").width()+28+$("#plus").width()+18+"px");
$("#"+c).css({visibility: "visible", display: "none"})
$("#"+c).fadeIn(function(){
if (c=="cm"){
if ($("#cm_scrollc").height()>$("#cm_scrollh").height()){
$("#cm_content").append('<div id="cm_slider"> </div>');
$("#cm_slider").fadeIn(function(){
$("#cm_slider").slider({
orientation: 'vertical',
animate: 'true',
value: 100,
change: handleSliderChange1,
slide: handleSliderSlide1
});
});
}
}
if (type==1){
load_pf("p1");
}
is_active = 0;
});
});
}
else{
is_active = 0;
}
});
});
});
});
return false;
}
function hide_content(){
$("#mm_ic_content ul li").filter(".sel").removeClass("sel");
if ($("#cl").length>0){
$("#cl").fadeOut(function(){ $(this).remove(); });
}
if ($("#cm").length>0){
$("#cm").fadeOut(function(){ $(this).remove(); });
}
if ($("#plus").length>0){
$("#plus").fadeOut(function(){ $(this).remove(); });
}
if ($("#sm").length>0){
$("#sm").fadeOut(function(){ $(this).remove(); });
}
if ($("#dline").length>0){
$("#dline").fadeOut(function(){ $(this).remove(); });
}
}
function boom(mm_pos_top,mm_pos_left,sel_mm,content,content_type){
$("#mm")
.css("top",mm_pos_top+"px")
.css("left",mm_pos_left+"px")
.css({visibility: "visible", display: "none"})
.fadeIn(function(){
is_active = 0;
if (content!=''){
load_content("a."+sel_mm,content+".html",content,content_type);
}
});
}
function show_mm(type,sel_mm,content,content_type){
is_active = 1;
hide_content();
var ww = $.clientCoords().width;
var wh = $.clientCoords().height;
var mm_w = $("#mm").width();
var mm_h = $("#mm").height();
var mm_pos_top = Math.round((wh-mm_h)/2)>30?Math.round((wh-mm_h)/2):30;
var mm_pos_left = Math.round((ww-mm_w)/2)>30?Math.round((ww-mm_w)/2):30;
if (type==0){
$('body').append('<div id="intro"><img src="images/intro2.gif" alt="Best Before" /></div>');
var intro_pos_top = Math.round((wh-$("#intro").height())/2)>30?Math.round((wh-$("#intro").height())/2):30;
var intro_pos_left = Math.round((ww-$("#intro").width())/2)>30?Math.round((ww-$("#intro").width())/2):30;
/* boom(mm_pos_top,mm_pos_left,sel_mm,content,content_type); */
$("#intro")
.css("top",intro_pos_top+"px")
.css("left",intro_pos_left+"px")
.css({visibility: "visible", display: "none"})
.fadeIn(function(){
var t = setTimeout('$("#intro").fadeOut(function(){boom("'+mm_pos_top+'","'+mm_pos_left+'","'+sel_mm+'","'+content+'","'+content_type+'");});',3000);
});
}
else{
$("#mm").animate({top:mm_pos_top,left:mm_pos_left});
is_active = 0;
}
}
function load_clpf(pf_id){
var sel_id = pf_id.replace("p","");
if ($("#cl").length > 0 ){
$("#pf_holder").fadeOut(function(){
$("#pf_holder").load("content/portofoliu"+sel_id+".html?r="+Math.floor(Math.random()*11),function(){
$("#pf_holder").fadeIn(function(){
pf_loading=0;
});
});
});
}
else{
$("#content").append('<div id="cl" class="portofoliu"><div id="cl_top"> </div><div id="cl_content"><div id="cl_ic"><div id="cl_ichl"> </div><div id="cl_ichr"> </div><div id="cl_ic_top"> </div><div id="cl_ic_content"><div id="cl_icl"> </div><div id="cl_icr"> </div><div id="cl_icch" class="loading"><div id="pf_holder"></div></div></div><div id="cl_ic_bottom"> </div></div></div><div id="cl_bottom"> </div></div>');
var ww = $.clientCoords().width;
var wh = $.clientCoords().height;
var mm_w = $("#mm").width()+28;
var dline_w = $("#dline").width()+16;
var sm_w = $("#sm").width()+28;
var plus_w = $("#plus").width()+9;
var cm_w = $("#cl").width()+28;
var content_width = mm_w+dline_w+sm_w+plus_w+cm_w;
var icontent_width = sm_w+plus_w+cm_w;
var content_height = 462+114;
var c_pos_top = Math.round((wh-content_height)/2)>30?Math.round((wh-content_height)/2):30;
var c_pos_left = Math.round((ww-content_width)/2);
var offset = 0;
var mm_pos_top = c_pos_top;
var mm_pos_left = c_pos_left;
var is_smm = 0;
if (content_width>(ww-60)){
offset = content_width - icontent_width;
c_pos_left = Math.round((ww-icontent_width)/2);
mm_pos_left = ((c_pos_left)>30?c_pos_left:30)-offset+28;
$("#sm").append('<div id="sm_menu"><a href="#">MENIU</a></div>');
is_smm = 1
}
$("#mm").animate({top:mm_pos_top,left:mm_pos_left},{ queue:true, duration:300 });
var dl_top = mm_pos_top+$("#mm").height()/2+40;
var dl_left = mm_pos_left+$("#mm").width()+14+8;
$("#dline").animate({top:dl_top,left:dl_left},{ queue:true, duration:300 });
var sm_top = mm_pos_top+$("#mm").height()/2-34;
var sm_left = mm_pos_left+$("#mm").width()+$("#dline").width()+14+8+18;
$("#sm").animate({top:sm_top,left:sm_left},300,function(){
if (is_smm==1){
$("#sm_menu").fadeIn();
}
$("#plus").css("top",sm_top+50+"px");
$("#plus").css("left",sm_left+($("#sm").width()+23)+"px");
$("#plus").css({visibility: "visible", display: "none"})
$("#plus").fadeIn(function(){
$("#cl").css("top",sm_top+"px");
$("#cl").css("left",sm_left+$("#sm").width()+28+$("#plus").width()+18+"px");
$("#cl").css({visibility: "visible", display: "none"})
$("#cl").fadeIn(function(){
$("#pf_holder").load("content/portofoliu"+sel_id+".html?r="+Math.floor(Math.random()*11),function(){
$("#pf_holder").fadeIn(function(){
is_clpf = 1;
});
});
});
});
});
}
}
function load_pf(pf_id){
$("#pf li a").filter(".sel").removeClass("sel");
$("#"+pf_id).addClass("sel");
var sel_id = pf_id.replace("p","");
if (pf_loading==0){
pf_loading=1;
$("#pf_holder").fadeOut(function(){
$("#pf_holder").load("content/portofoliu"+sel_id+".html?r="+Math.floor(Math.random()*11),function(){
$("#pf_holder").fadeIn(function(){
var slides = $('#pnavh a').size();
if (slides>10){
$('#pnavh a#i10').addClass("plus");
}
pf_loading=0;
});
});
});
}
}
var is_active = 0;
var pf_loading = 0;
var content = '';
var content_type = 0;
var amm = '';
$(document).ready(function(){
/*
if(jQuery){
jQuery("body").addClass("ts");
}
*/
show_mm(0,amm,content,content_type);
$("a.mm").click(function(){
if (is_active==0) show_mm(1,amm,content,content_type);
return false;
});
$("#sm_menu a").live('click',function(){
if (is_active==0) show_mm(1,amm,content,content_type);
return false;
});
$("a.mm1").click(function(){
if (is_active==0) load_content(this,"despre.html","despre",0);
return false;
});
$("a.mm2").click(function(){
if (is_active==0) load_content(this,"servicii.html","servicii",0);
return false;
});
$("a.mm3").click(function(){
if (is_active==0) load_content(this,"portofoliu.html","portofoliu",1);
return false;
});
$("a.mm4").click(function(){
if (is_active==0) load_content(this,"clienti.html","clienti",2);
return false;
});
$("a.mm5").click(function(){
if (is_active==0) load_content(this,"contact.html","contact",0);
return false;
});
$("a.mm6").click(function(){
if (is_active==0) load_content(this,"news.html","news",0);
return false;
});
$("#cl_list li a").live('click',function(){
var pf_id = $(this).attr("id");
load_clpf(pf_id);
return false;
});
$("#pf li a").live('click',function(){
var pf_id = $(this).attr("id");
load_pf(pf_id);
return false;
});
$("#pnav a").live('click',function(){
var my_id = $(this).attr("id");
var my_link = $(this);
var sel_id = my_id.replace("i","");
var step = 500;
var action_step = 0;
if (pf_loading==0){
pf_loading = 1;
if ($('#pnav').width()>=190){
var slides = $('#pnavh a').size();
var lslides = -$('#pnavh').position().left/19;
var rslides = slides-10+($('#pnavh').position().left/19);
var sstep = 0;
if (sel_id==(lslides+10)){ // next
if (rslides<9){
sstep = 19*rslides;
}
else{
sstep = 19*9;
}
$('#pnavh').animate({left:'-='+sstep},300);
}
if (lslides>0 && sel_id==(lslides+1)){ // previous
if (lslides<9){
sstep = 19*lslides;
}
else{
sstep = 19*9;
}
$('#pnavh').animate({left:'+='+sstep},300);
}
}
action_step = step*(sel_id-1);
h_step = 54 * (sel_id-1);
if (h_step+"px"!=$('#pf_hh').css("top")){
$('#pf_hh').fadeOut(function(){
$('#pf_hh').css("top","-"+h_step+"px");
$('#pf_hh').fadeIn();
});
}
$('#pf_imgh').animate({left:'-'+action_step},300,function(){
$("#pnav a").filter(".sel").removeClass("sel");
my_link.addClass("sel");
var slides = $('#pnavh a').size();
var lslides = -$('#pnavh').position().left/19;
var rslides = slides-10+($('#pnavh').position().left/19);
$("#pnavh a").removeClass("plus");
$("#pnavh a").removeClass("minus");
if (rslides>0){
var ps = lslides+10;
$("#pnavh a#i"+ps).addClass("plus");
}
if (lslides>0){
var ms = lslides+1;
$("#pnavh a#i"+ms).addClass("minus");
}
pf_loading = 0;
});
}
return false;
});
});
Syndicate
Categories
Statistics
There are 330 Sites with 745 Links of Interest in 18 Categories. The latest Site was added 4 months ago.
About
This is a project by Sebastian Senf, for his part jQuery user and lover too. Follow me.