23/12/2014

Encomenda do Túlio

Hello!
Sou eu de novo vim entregar o "presente" do Túlio espero que ele goste e que vocês encomendem!
Ficou simples e fofo ao mesmo tempo:
<SCRIPT TYPE="TEXT/JAVASCRIPT" SRC="HTTP://AJAX.GOOGLEAPIS.COM/AJAX/LIBS/JQUERY/1.3.2/JQUERY.MIN.JS"></SCRIPT>
<SCRIPT TYPE='TEXT/JAVASCRIPT' LANGUAGE='JAVASCRIPT'>
VAR SCROLLTOTOP={
//STARTLINE: INTEGER. NUMBER OF PIXELS FROM TOP OF DOC SCROLLBAR IS SCROLLED BEFORE SHOWING CONTROL
//SCROLLTO: KEYWORD (INTEGER, OR "SCROLL_TO_ELEMENT_ID"). HOW FAR TO SCROLL DOCUMENT UP WHEN CONTROL IS CLICKED ON (1=TOP).
SETTING: {STARTLINE:100, SCROLLTO: 0, SCROLLDURATION:1000, FADEDURATION:[500, 100]},
CONTROLHTML: '<IMG SRC="http://1.bp.blogspot.com/-A7oS2lW-6ZQ/VJnaIVFbjqI/AAAAAAAAFH8/KJzc_LJuVEU/s1600/Encomenda%2BTulio%2B1.png"/>', //HTML FOR CONTROL, WHICH IS AUTO WRAPPED IN DIV W/ ID="TOPCONTROL"
CONTROLATTRS: {OFFSETX:5, OFFSETY:5}, //OFFSET OF CONTROL RELATIVE TO RIGHT/ CENTER OF WINDOW CORNER
ANCHORKEYWORD: '#TOP', //ENTER HREF VALUE OF HTML ANCHORS ON THE PAGE THAT SHOULD ALSO ACT AS "SCROLL UP" LINKS
STATE: {ISVISIBLE:FALSE, SHOULDVISIBLE:FALSE},
SCROLLUP:FUNCTION(){
IF (!THIS.CSSFIXEDSUPPORT) //IF CONTROL IS POSITIONED USING JAVASCRIPT
THIS.$CONTROL.CSS({OPACITY:0}) //HIDE CONTROL IMMEDIATELY AFTER CLICKING IT
VAR DEST=ISNAN(THIS.SETTING.SCROLLTO)? THIS.SETTING.SCROLLTO : PARSEINT(THIS.SETTING.SCROLLTO)
IF (TYPEOF DEST=="STRING" && JQUERY('#'+DEST).LENGTH==1) //CHECK ELEMENT SET BY STRING EXISTS
DEST=JQUERY('#'+DEST).OFFSET().TOP
ELSE
DEST=0
THIS.$BODY.ANIMATE({SCROLLTOP: DEST}, THIS.SETTING.SCROLLDURATION);
},
KEEPFIXED:FUNCTION(){
VAR $WINDOW=JQUERY(WINDOW)
VAR CONTROLX=$WINDOW.SCROLLLEFT() + $WINDOW.WIDTH() - THIS.$CONTROL.WIDTH() - THIS.CONTROLATTRS.OFFSETX
VAR CONTROLY=$WINDOW.SCROLLTOP() + $WINDOW.HEIGHT() - THIS.$CONTROL.HEIGHT() - THIS.CONTROLATTRS.OFFSETY
THIS.$CONTROL.CSS({LEFT:CONTROLX+'PX', TOP:CONTROLY+'PX'})
},
TOGGLECONTROL:FUNCTION(){
VAR SCROLLTOP=JQUERY(WINDOW).SCROLLTOP()
IF (!THIS.CSSFIXEDSUPPORT)
THIS.KEEPFIXED()
THIS.STATE.SHOULDVISIBLE=(SCROLLTOP>=THIS.SETTING.STARTLINE)? TRUE : FALSE
IF (THIS.STATE.SHOULDVISIBLE && !THIS.STATE.ISVISIBLE){
THIS.$CONTROL.STOP().ANIMATE({OPACITY:1}, THIS.SETTING.FADEDURATION[0])
THIS.STATE.ISVISIBLE=TRUE
}
ELSE IF (THIS.STATE.SHOULDVISIBLE==FALSE && THIS.STATE.ISVISIBLE){
THIS.$CONTROL.STOP().ANIMATE({OPACITY:0}, THIS.SETTING.FADEDURATION[1])
THIS.STATE.ISVISIBLE=FALSE
}
},
INIT:FUNCTION(){
JQUERY(DOCUMENT).READY(FUNCTION($){
VAR MAINOBJ=SCROLLTOTOP
VAR IEBRWS=DOCUMENT.ALL
MAINOBJ.CSSFIXEDSUPPORT=!IEBRWS || IEBRWS && DOCUMENT.COMPATMODE=="CSS1COMPAT" && WINDOW.XMLHTTPREQUEST //NOT IE OR IE7+ BROWSERS IN STANDARDS MODE
MAINOBJ.$BODY=(WINDOW.OPERA)? (DOCUMENT.COMPATMODE=="CSS1COMPAT"? $('HTML') : $('BODY')) : $('HTML,BODY')
MAINOBJ.$CONTROL=$('<DIV ID="TOPCONTROL">'+MAINOBJ.CONTROLHTML+'</DIV>')
.CSS({POSITION:MAINOBJ.CSSFIXEDSUPPORT? 'FIXED' : 'ABSOLUTE', BOTTOM:MAINOBJ.CONTROLATTRS.OFFSETY, RIGHT:MAINOBJ.CONTROLATTRS.OFFSETX, OPACITY:0, CURSOR:'POINTER'})
.ATTR({TITLE:''})
.CLICK(FUNCTION(){MAINOBJ.SCROLLUP(); RETURN FALSE})
.APPENDTO('BODY')
IF (DOCUMENT.ALL && !WINDOW.XMLHTTPREQUEST && MAINOBJ.$CONTROL.TEXT()!='') //LOOSE CHECK FOR IE6 AND BELOW, PLUS WHETHER CONTROL CONTAINS ANY TEXT
MAINOBJ.$CONTROL.CSS({WIDTH:MAINOBJ.$CONTROL.WIDTH()}) //IE6- SEEMS TO REQUIRE AN EXPLICIT WIDTH ON A DIV CONTAINING TEXT
MAINOBJ.TOGGLECONTROL()
$('A[HREF="' + MAINOBJ.ANCHORKEYWORD +'"]').CLICK(FUNCTION(){
MAINOBJ.SCROLLUP()
RETURN FALSE
})
$(WINDOW).BIND('SCROLL RESIZE', FUNCTION(E){
MAINOBJ.TOGGLECONTROL()
})
})
}
}
SCROLLTOTOP.INIT()
</SCRIPT>

www
----
Encomendem!


3 comentários:

  1. Adorei Isynhaa!Já vou colocar no blog ^^ Hoje ou amanhã eu vou fazer um post sobre Natal,ok? Beijos ♥

    ResponderExcluir

Vai Comentar,Estou feliz mas Sigas Essas Regras ♥
1-Não falar Palavrões ou Linguagem Inapropriada
2-Só aceito "seguindo segue de volta" se falar sobre o post
3-Comente sobre o post
Caso não respeitar qualquer regra seu comentario será apagado,beijinhos♥

© Sweet Cupcake - 2015. Todos os direitos reservados.
Criado por: Isy Hatter.
Tecnologia do Blogger.
imagem-logo