From 71ea17b5d88e7ce1286186a6157f88a45d1bbe8c Mon Sep 17 00:00:00 2001 From: p5ty43vaq <17817962790@163.com> Date: Tue, 11 Jun 2024 08:00:55 +0800 Subject: [PATCH] ADD file via upload --- index.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..b4cc621 --- /dev/null +++ b/index.js @@ -0,0 +1,50 @@ +$(document).ready(function () { + // 设置热门小说的宽度 + getHotStroWidth(); + $(window).resize(function () { + getHotStroWidth(); + }) + nrarrRead(); + silde(); +}); + +function getHotStroWidth() { + var $hotStro = $('#i-hot-nov'); + var marginLeft; + var screenWidth = parseInt($('#i-content').width()); + var $stroList = $hotStro.children('.i-c-stroe'); + var width = $($stroList[0]).width() + 6; + console.log(width) + var widthAll = width * $stroList.length; + var x, movespacing; + $hotStro.css('width', widthAll + 'px'); + $hotStro.on('touchstart', function (e) { + x = e.originalEvent.targetTouches[0].pageX; + marginLeft = $hotStro.css('marginLeft'); + }); + $hotStro.on('touchmove', function (e) { + var touch = e.originalEvent.targetTouches[0] + var xa = touch.pageX; + movespacing = parseInt(xa) - parseInt(x); + var left = movespacing + parseInt(marginLeft); + if (left > 0 || (-left + screenWidth - 8) > widthAll) { + return + } + $hotStro.css('marginLeft', left) + }) +} + +function nrarrRead() { + var $read = $('#r_near_read'); + var $noLogin = $('.r-no-login'); + var $reads = $('.r-zuijin-readw'); + var num = 0; + $read.click(function () { + $('#r_content').toggleClass('jq_hide') + if (num === 0) { + $noLogin.toggleClass('jq_hide') + } else { + $reads.toggleClass('jq_hide') + } + }) +}