news_detail.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. $(document).ready(function () {
  2. var mySwiper = new Swiper('.swiper-container', {
  3. autoplay: true, //可选选项,自动滑动
  4. loop: true,
  5. direction: 'horizontal',
  6. navigation: {
  7. nextEl: '.swiper-button-next',
  8. prevEl: '.swiper-button-prev',
  9. },
  10. pagination: {
  11. el: '.swiper-pagination',
  12. clickable: true,
  13. renderBullet: function (index, className) {
  14. var text = index + 1;
  15. return '<div class="' + className + '">' + text + '</div>';
  16. },
  17. }
  18. });
  19. $('#example-navbar-collapse .dropdow_menu a').click(function (e) {
  20. if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
  21. var target = $(this.hash);
  22. target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
  23. console.log(target)
  24. if (target.length) {
  25. $('html,body').animate({
  26. scrollTop: target.offset().top - 40
  27. }, 900);
  28. return false;
  29. }
  30. }
  31. });
  32. $(document).off('click.bs.dropdown.data-api');
  33. $('.top').click(function (e) {
  34. e.preventDefault();
  35. $("body,html").animate({
  36. scrollTop: 0
  37. }, 500);
  38. });
  39. });