Guest User

Untitled

a guest
Jul 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 KB | None | 0 0
  1. <script>
  2. var coordinates = {
  3. "actors" : 0,
  4. "director" : 230,
  5. "writer" : 308,
  6. "photography" : 375,
  7. "drama" : 411,
  8. "effects" : 486,
  9. "music" : 579,
  10. "producer" : 696
  11. };
  12. function findDimensions(){
  13. var width = 0, height = 0;
  14. if(window.innerWidth){
  15. width = window.innerWidth;
  16. height = window.innerHeight;
  17. }
  18. else if(document.body && document.body.clientWidth){
  19. width = document.body.clientWidth;
  20. height = document.body.clientHeight;
  21. }
  22. if(document.documentElement && document.documentElement.clientWidth){
  23. width = document.documentElement.clientWidth;
  24. height = document.documentElement.clientHeight;
  25. }
  26. var ret=new Array();
  27. ret['width']=width;
  28. ret['height']=height;
  29. return ret;
  30. }
  31.  
  32. function SlideTo(role){
  33. $(".handler").animate({'left' : coordinates[role]});
  34. var new_left = - (4880 - 839) * (coordinates[role] / 696);
  35. $(".people_and_names").animate({'left' : new_left});
  36. $(".switcher li").removeClass("active");
  37. $("#li_" + role).addClass("active");
  38. }
  39.  
  40. var prev_active = 'actors';
  41. function ListenSlider(cleft){
  42. var diff = 999999;
  43. var act = '';
  44. for(var i in coordinates){
  45. var cccoord=coordinates[i] ? coordinates[i] : 200;
  46. if( Math.abs(cccoord - cleft) < diff){
  47. act = i;
  48. diff = Math.abs(cccoord - cleft);
  49. }
  50. }
  51. if(prev_active != act)
  52. {
  53. $(".switcher li").removeClass("active");
  54. $("#li_" + act).addClass("active");
  55. prev_active = act;
  56. }
  57. }
  58.  
  59. var CurrentBG='bgOct';
  60. var monitor = {};
  61. var offsets = {
  62. "background": 100,
  63. "person": 50
  64. }
  65.  
  66. var GlobalOffset = 0;
  67. var MousePos = monitor.width/2;
  68.  
  69. function InitParallax(){
  70. $("body").mousemove(function(e){
  71. for(var type in offsets){
  72. offset = -1* (e.clientX/monitor.width) * offsets[type] + GlobalOffset ;
  73. $("." + type).css({'left': offset});
  74. }
  75.  
  76. MousePos = e.clientX;
  77. ShowTitles();
  78. });
  79. ShowTitles();
  80. setTimeout(Switch,5000);
  81. }
  82.  
  83. function ShowTitles(){
  84. if(!monitor || !monitor.width) {
  85. monitor = {'width':1400};
  86. }
  87.  
  88. if(GlobalOffset == 0 || GlobalOffset == 5600){
  89. $(".background .bgOct .title, .background .bgOct2 .title")
  90. .fadeIn('slow')
  91. .css({'marginLeft': (MousePos/monitor.width) * 20 + 850});
  92. }
  93.  
  94. if(GlobalOffset == -1400 ){
  95. $(".background .bgDorin .title")
  96. .fadeIn('slow')
  97. .css({'marginLeft': (MousePos/monitor.width) * 30 + 170});
  98. }
  99.  
  100. if(GlobalOffset == -2800 ){
  101. $(".background .bgNadya .title")
  102. .fadeIn('slow')
  103. .css({'marginLeft': (MousePos/monitor.width) * 30 + 840});
  104. }
  105.  
  106. if(GlobalOffset == -4200 ){
  107. $(".background .bgPetrakovich .title")
  108. .fadeIn('slow')
  109. .css({'marginLeft': (MousePos/monitor.width) * 30 + 920});
  110. }
  111.  
  112. }
  113. function Switch(){
  114.  
  115. $("body").unbind("mousemove");
  116. if(GlobalOffset == -5600){
  117. $(".background").css({'left' : '0'});
  118. $(".person").css({'left' : '0'});
  119. GlobalOffset = 0;
  120. }
  121.  
  122. $(".person").animate({'left' : '-=1400'}, 1500,function(){
  123. GlobalOffset-=1400;
  124. InitParallax();
  125. });
  126.  
  127. setTimeout(function(){
  128. $(".background").animate({'left' : '-=1400'}, 800,function(){});
  129. },200);
  130.  
  131.  
  132.  
  133.  
  134. }
  135.  
  136.  
  137.  
  138.  
  139. $(function(){
  140. $(".bgDorin").addClass("bgDorinIMG");
  141. setTimeout(function(){ $(".bgNadya").addClass("bgNadyaIMG"); }, 2000);
  142. setTimeout(function(){ $(".bgPetrakovich").addClass("bgPetrakovichIMG"); }, 5000);
  143. monitor = findDimensions();
  144. InitParallax();
  145. $(".handler").draggable({
  146. axis: "x",
  147. containment: "parent",
  148. drag: function() {
  149.  
  150. var new_left = - (4880 - 839) * ($(this).position().left / 696)
  151. $(".people_and_names").css({'left' : new_left});
  152. ListenSlider($(this).position().left);
  153. }
  154. });
  155.  
  156. })
  157.  
  158. </script>
Add Comment
Please, Sign In to add comment