Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. <iframe width="280" height="60" src="link da música via youtube" frameborder="0" allowfullscreen></iframe>
  2.  
  3. •escreva aqui•
  4.  
  5. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  6. <script type='text/javascript' language='Javascript'>
  7. var scrolltotop={
  8. //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
  9. //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (1=top).
  10. setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
  11. controlHTML: '<img src="GIF OU FOTO PARA SUBIR AO TOPO"/>', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
  12. controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ center of window corner
  13. anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
  14. state: {isvisible:false, shouldvisible:false},
  15. scrollup:function(){
  16. if (!this.cssfixedsupport) //if control is positioned using JavaScript
  17. this.$control.css({opacity:0}) //hide control immediately after clicking it
  18. var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
  19. if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
  20. dest=jQuery('#'+dest).offset().top
  21. else
  22. dest=0
  23. this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
  24. },
  25. keepfixed:function(){
  26. var $window=jQuery(window)
  27. var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
  28. var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
  29. this.$control.css({left:controlx+'px', top:controly+'px'})
  30. },
  31. togglecontrol:function(){
  32. var scrolltop=jQuery(window).scrollTop()
  33. if (!this.cssfixedsupport)
  34. this.keepfixed()
  35. this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
  36. if (this.state.shouldvisible && !this.state.isvisible){
  37. this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
  38. this.state.isvisible=true
  39. }
  40. else if (this.state.shouldvisible==false && this.state.isvisible){
  41. this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
  42. this.state.isvisible=false
  43. }
  44. },
  45. init:function(){
  46. jQuery(document).ready(function($){
  47. var mainobj=scrolltotop
  48. var iebrws=document.all
  49. mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
  50. mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
  51. mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
  52. .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
  53. .attr({title:'Scroll Back to Top'})
  54. .click(function(){mainobj.scrollup(); return false})
  55. .appendTo('body')
  56. if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
  57. mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
  58. mainobj.togglecontrol()
  59. $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
  60. mainobj.scrollup()
  61. return false
  62. })
  63. $(window).bind('scroll resize', function(e){
  64. mainobj.togglecontrol()
  65. })
  66. })
  67. }
  68. }
  69. scrolltotop.init()
  70. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement