html滚动字幕鼠标放上去就停止,【快看!】jq 动画滚动字幕,stop()停止动画后再移入速度变慢问题...

最新问题:

1.第一次滚动时,到后面速度突然变慢(为什么??),后面只要鼠标不移上去正常速度

2.为什么鼠标移上去后,速度有所下降???

代码如下,为什么对a监听鼠标移入事件不触发??

因为用了append,要做事件委托

该如何实现如题所述效果~~

html{

font-size:16px;

}

#notice {

height: 1.875rem;

font-size: 1rem;

line-height: 1.875rem;

color: #58637e;

margin-top: 1.875rem;

/* margin-top: 1.875rem; */

background: #f4f4f4;

}

#notice span {

display: block;

width: 22px;

height: 100%;

background: url(../img/index/notice.png) center center/22px 22px no-repeat;

margin-right: 10px;

}

#notice div.marquee {

display: block;

height: 100%;

width: 1136px;

width: 71rem;

overflow: hidden;

}

#notice div.marquee a {

width: auto;

height: 100%;

color: #666666;

display: inline-block;

text-decoration: none;

}

// 字幕滚动

startMarquee();

function startMarquee() {

var ele = $('.marquee a');

ele.css({

'margin-left': ele.parents().innerWidth() + 'px',

});

marquee();

}

function marquee() {

var ele = $('.marquee a');

var ele_width = ele.innerWidth();

console.log(parseInt(ele.css('margin-left')), parseInt(-(ele_width)));

if (parseInt(ele.css('margin-left')) <= parseInt(-(ele_width))) {

console.log(parseInt(ele.css('margin-left')) + '<=' + parseInt(-(ele_width)));

ele.css({

'margin-left': ele.parents().innerWidth() + 'px',

});

}

ele.animate({

marginLeft: -(ele_width) + 'px',

}, 5000, 'linear', marquee);

}

mousemoveStop($('.marquee a'));

function mousemoveStop(ele) {

$('.marquee').on('mouseover', ele, function () {

console.log('mouseover');

$('.marquee a').stop();

}).on('mouseleave', ele, function () {

console.log('mouseout');

marquee();

});

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值