Home >Web Front-end >JS Tutorial >jQuery implemented html slider that supports IE_jquery

jQuery implemented html slider that supports IE_jquery

WBOY
WBOYOriginal
2016-05-16 16:09:081066browse

复制代码 代码如下:









<script><br> var $dom = $(document);<br> $dom.on('mousedown','#d',function (argument) {<br>     $(this).data('mouse','down');<br>     console.log('down');<br> })<br> $dom.on('mouseup',function(){<br>     $('#d').data('mouse','up');<br>     console.log('up');<br> });<br> $dom.on('mousemove','#d',function(event){<br>     if($(this).data('mouse') == 'down'){<br>         var m_x = event.clientX;<br>         var d_b = $(this).find('.d_b');<br>         m_x = m_x < 8 ? 8 : m_x;<br />         m_x = m_x > 208 ? 208: m_x;<br>         d_b.css('left',m_x-13);<br>         var max = $(this).attr('max');<br>         $(this).attr('value', Math.floor((m_x-8)/200 * max))<br>         console.log($(this).attr('value'));<br>         $('#text').text($(this).attr('value'))<br>     }<br> });<br> </script>

效果图:

以上就是本文的全部内容了,希望能够对大家学习使用jQuery有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn