hint.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. $(document).ready(function () {
  2. //解决iOS中伪类:active失效
  3. document.body.addEventListener('touchstart', function () {
  4. });
  5. //当弹窗出现时内容层禁止滚动
  6. $("body").on("touchmove", function (event) {
  7. if ($("iframe").is(":visible") == true) {
  8. event.preventDefault();
  9. }
  10. })
  11. });
  12. function scrollContent() {
  13. aler("111");
  14. this.interval = setInterval(() => {
  15. this.scrollToEnd();
  16. }, 500)
  17. }
  18. function scrollToEnd() {
  19. document.body.scrollTop = document.body.scrollHeight;
  20. }
  21. function clearSrcoll() {
  22. clearInterval(this.interval);
  23. }
  24. function on_off_hint() {
  25. if ($(".hint_shadow").attr("style") == "display:block") {
  26. hint = 0;
  27. $(".hint_shadow").attr("style", "display:none");
  28. $(".hint_mian").attr("style", "display:none");
  29. $('body').removeClass('hint_body');//去掉给body的类
  30. $(window).scrollTop(top);//设置页面滚动的高度,如果不设置,关闭弹出层时页面会回到顶部。
  31. } else {
  32. hint = 1;
  33. $(".hint_shadow").attr("style", "display:block");
  34. $(".hint_mian").attr("style", "display:block");
  35. top = $(window).scrollTop();//获取页面的scrollTop;
  36. $('body').css("top", -top + "px");//给body一个负的top值;
  37. $('body').addClass('hint_body');//给body增加一个类,position:fixed;
  38. }
  39. }