Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. $(document).ready (() => {
  2. console.log($(window).width());
  3. if($(window).width() === 1920) {
  4. $('.main-photo').height(1015);
  5. }else if($(window).width() === 1280) {
  6. $('.main-photo').height(674);
  7. }else if($(window).width() === 1351) {
  8. $('.main-photo').height(700);
  9. }else if($(window).width() === 1024) {
  10. $('.main-photo').height(533);
  11. }else if($(window).width() === 768) {
  12. $('.main-photo').height(393);
  13. }else if($(window).width() === 425) {
  14. $('.main-photo').height(201);
  15. }else if($(window).width() === 375) {
  16. $('.main-photo').height(170);
  17. }else if($(window).width() === 320) {
  18. $('.main-photo').height(143);
  19. }
  20. });
  21.  
  22. window.onload = function () {
  23. jQuery(".selected_city").text(ymaps.geolocation.city);
  24. };
  25.  
  26. $(window).on('scroll', () => {
  27. let scrollCoef = 0.0002;
  28. let r = 1 - $(window).scrollTop() * scrollCoef;
  29. $('.head').css ({
  30. backgroundColor: "rgba(14,26,100,"+r+')'})
  31. });
  32.  
  33. //при нажатии на ссылку
  34. $(".navbar-collapse>ul>li>a").click(() => {
  35. //если она не имеет класс dropdown-toggle
  36. if (!$(this).hasClass("dropdown-toggle")) {
  37. //то закрыть меню
  38. $(".navbar-collapse").collapse('hide');
  39. }
  40. });
  41.  
  42. $(".navbar-collapse>ul>li>select").change(() => {
  43. $(".navbar-collapse").collapse('hide');
  44. });
  45.  
  46. $('#select').change(function() {
  47. let city = $(this).val();
  48. $('.selected_city').text(city);
  49. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement