Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.31 KB | None | 0 0
  1. $(function() {
  2. $('.btn-6')
  3. .on('mouseenter', function(e) {
  4. var parentOffset = $(this).offset(),
  5. relX = e.pageX - parentOffset.left,
  6. relY = e.pageY - parentOffset.top;
  7. $(this).find('span').css({top:relY, left:relX})
  8. })
  9. .on('mouseout', function(e) {
  10. var parentOffset = $(this).offset(),
  11. relX = e.pageX - parentOffset.left,
  12. relY = e.pageY - parentOffset.top;
  13. $(this).find('span').css({top:relY, left:relX})
  14. });
  15. $('[href=#]').click(function(){return false});
  16. });
  17.  
  18. var header = $('.register');
  19.  
  20. var backgrounds = new Array(
  21. 'url(https://i0.wp.com/landgames.fr/wp-content/uploads/2019/04/background-habbo-6-2.png?ssl=1)'
  22. , 'url(https://vignette.wikia.nocookie.net/habbo-wikia/images/5/50/Wiki-background/revision/latest?cb=20140624140739&path-prefix=fr)'
  23. , 'url(https://puhekupla.com/images/uploads/view_1485183538_5970.png)'
  24. , 'url(https://i.imgur.com/J6aDQol.png)'
  25. );
  26.  
  27. var current = 0;
  28.  
  29. function nextBackground() {
  30. current++;
  31. current = current % backgrounds.length;
  32. header.css('background-image', backgrounds[current]);
  33. }
  34. setInterval(nextBackground, 5000);
  35.  
  36. header.css('background-image', backgrounds[0]);
  37.  
  38. (function($) {
  39. $.fn.menumaker = function(options) {
  40. var cssmenu = $(this), settings = $.extend({
  41. format: "dropdown",
  42. sticky: false
  43. }, options);
  44. return this.each(function() {
  45. $(this).find(".button").on('click', function(){
  46. $(this).toggleClass('menu-opened');
  47. var mainmenu = $(this).next('ul');
  48. if (mainmenu.hasClass('open')) {
  49. mainmenu.slideToggle().removeClass('open');
  50. }
  51. else {
  52. mainmenu.slideToggle().addClass('open');
  53. if (settings.format === "dropdown") {
  54. mainmenu.find('ul').show();
  55. }
  56. }
  57. });
  58. cssmenu.find('li ul').parent().addClass('has-sub');
  59. multiTg = function() {
  60. cssmenu.find(".has-sub").prepend('<span class="submenu-button"></span>');
  61. cssmenu.find('.submenu-button').on('click', function() {
  62. $(this).toggleClass('submenu-opened');
  63. if ($(this).siblings('ul').hasClass('open')) {
  64. $(this).siblings('ul').removeClass('open').slideToggle();
  65. }
  66. else {
  67. $(this).siblings('ul').addClass('open').slideToggle();
  68. }
  69. });
  70. };
  71. if (settings.format === 'multitoggle') multiTg();
  72. else cssmenu.addClass('dropdown');
  73. if (settings.sticky === true) cssmenu.css('position', 'fixed');
  74. resizeFix = function() {
  75. var mediasize = 1000;
  76. if ($( window ).width() > mediasize) {
  77. cssmenu.find('ul').show();
  78. }
  79. if ($(window).width() <= mediasize) {
  80. cssmenu.find('ul').hide().removeClass('open');
  81. }
  82. };
  83. resizeFix();
  84. return $(window).on('resize', resizeFix);
  85. });
  86. };
  87. })(jQuery);
  88.  
  89. (function($){
  90. $(document).ready(function(){
  91. $("#cssmenu").menumaker({
  92. format: "multitoggle"
  93. });
  94. });
  95. })(jQuery);
  96.  
  97.  
  98. var _gaq = _gaq || [];
  99. _gaq.push(['_setAccount', 'UA-1965499-1']);
  100. _gaq.push(['_trackPageview']);
  101.  
  102. (function() {
  103. var ga = document.createElement('script');
  104. ga.type = 'text/javascript';
  105. ga.async = true;
  106. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  107. var s = document.getElementsByTagName('script')[0];
  108. s.parentNode.insertBefore(ga, s);
  109. })();
  110.  
  111.  
  112.  
  113.  
  114. /* Create this file and add to your js folder : vertical.news.slider.js */
  115.  
  116. /*globals window, $, clearInterval, setInterval */
  117.  
  118. $(function () {
  119. "use strict";
  120.  
  121. var hl,
  122. newsList = $('.news-headlines'),
  123. newsListItems = $('.news-headlines li'),
  124. firstNewsItem = $('.news-headlines li:nth-child(1)'),
  125. newsPreview = $('.news-preview'),
  126. elCount = $('.news-headlines').children(':not(.highlight)').index(),
  127. vPadding = (parseInt(firstNewsItem.css('padding-top').replace('px', ''), 10)) +
  128. (parseInt(firstNewsItem.css('padding-bottom').replace('px', ''), 10)),
  129. vMargin = (parseInt(firstNewsItem.css('margin-top').replace('px', ''), 10)) +
  130. (parseInt(firstNewsItem.css('margin-bottom').replace('px', ''), 10)),
  131. cPadding = (parseInt($('.news-content').css('padding-top').replace('px', ''), 10)) +
  132. (parseInt($('.news-content').css('padding-bottom').replace('px', ''), 10)),
  133. speed = 5000, // this is the speed of the switch
  134. myTimer = null,
  135. siblings = null,
  136. totalHeight = null,
  137. indexEl = 1,
  138. i = null;
  139.  
  140. // the css animation gets added dynamicallly so
  141. // that the news item sizes are measured correctly
  142. // (i.e. not in mid-animation)
  143. // Also, appending the highlight item to keep HTML clean
  144. newsList.append('<li class="highlight nh-anim"></li>');
  145. hl = $('.highlight');
  146. newsListItems.addClass('nh-anim');
  147.  
  148. function doEqualHeight(c) {
  149.  
  150. if (newsPreview.height() < newsList.height()) {
  151. newsPreview.height(newsList.height());
  152. } else if ((newsList.height() < newsPreview.height()) && (newsList.height() > parseInt(newsPreview.css('min-height').replace('px', ''), 10))) {
  153. newsPreview.height(newsList.height());
  154. }
  155.  
  156. if ($('.news-content:nth-child(' + c + ')').height() > newsPreview.height()) {
  157. newsPreview.height($('.news-content:nth-child(' + c + ')').height() + cPadding);
  158. }
  159. }
  160.  
  161. function doTimedSwitch() {
  162.  
  163. myTimer = setInterval(function () {
  164. if (($('.selected').prev().index() + 1) === elCount) {
  165. firstNewsItem.trigger('click');
  166. } else {
  167. $('.selected').next(':not(.highlight)').trigger('click');
  168. }
  169. }, speed);
  170.  
  171. }
  172.  
  173. $('.news-content').on('mouseover', function () {
  174. clearInterval(myTimer);
  175. });
  176.  
  177. $('.news-content').on('mouseout', function () {
  178. doTimedSwitch();
  179. });
  180.  
  181. function doClickItem() {
  182.  
  183. newsListItems.on('click', function () {
  184.  
  185. newsListItems.removeClass('selected');
  186. $(this).addClass('selected');
  187.  
  188. siblings = $(this).prevAll();
  189. totalHeight = 0;
  190.  
  191. // this loop calculates the height of individual elements, including margins/padding
  192. for (i = 0; i < siblings.length; i += 1) {
  193. totalHeight += $(siblings[i]).height();
  194. totalHeight += vPadding;
  195. totalHeight += vMargin;
  196. }
  197.  
  198. // this moves the highlight vertically the distance calculated in the previous loop
  199. // and also corrects the height of the highlight to match the current selection
  200. hl.css({
  201. top: totalHeight,
  202. height: $(this).height() + vPadding
  203. });
  204.  
  205. indexEl = $(this).index() + 1;
  206.  
  207. $('.news-content:nth-child(' + indexEl + ')').siblings().removeClass('top-content');
  208. $('.news-content:nth-child(' + indexEl + ')').addClass('top-content');
  209.  
  210. clearInterval(myTimer);
  211. // comment out the line below if you don't
  212. // want it to rotate automatically
  213. doTimedSwitch();
  214. doEqualHeight(indexEl);
  215. });
  216.  
  217. }
  218.  
  219. function doWindowResize() {
  220.  
  221. $(window).resize(function () {
  222.  
  223. clearInterval(myTimer);
  224. // click is triggered to recalculate and fix the highlight position
  225. $('.selected').trigger('click');
  226.  
  227. });
  228.  
  229. }
  230.  
  231. // this is the poor man's 'init' section
  232. doClickItem();
  233. doWindowResize();
  234. $('.selected').trigger('click');
  235.  
  236. });
  237. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement