HTML5¼¼Êõ

jQuery Mobile Slider ½ûÓõã»÷ʼþ - °¢×Ó

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-12-07 17:02 ÎÒÒªÆÀÂÛ( )

°¢×ÓÔ­´´£¬×ªÔØÇë×¢Ã÷³ö´¦¡£ ÔÚʹÓÃjQuery Mobile Sliderʱ£¬·¢ÏÖÔÚÒ³ÃæÉÏÏÂÍ϶¯Ê±£¬ºÜÈÝÒײ»Ð¡ÐÄ´¥·¢SliderµÄµã»÷ʼþ£¬´Ó¶øÔì³ÉÎó²Ù×÷¡£Îª´ËÐèÒª½ûÓÃSliderµÄµã»÷ʼþ¡£ ¹Ù·½API²¢Ã»ÓÐÌṩ½ûÓõã»÷ʼþµÄʼþµÄ·½·¨£¬Òò´ËҪʵÏÖÕâÒ»¹¦ÄÜÖ»ÄÜÁí±Ùõ辶¡£ Áô

°¢×ÓÔ­´´£¬×ªÔØÇë×¢Ã÷³ö´¦¡£

ÔÚʹÓÃjQuery Mobile Sliderʱ£¬·¢ÏÖÔÚÒ³ÃæÉÏÏÂÍ϶¯Ê±£¬ºÜÈÝÒײ»Ð¡ÐÄ´¥·¢SliderµÄµã»÷ʼþ£¬´Ó¶øÔì³ÉÎó²Ù×÷¡£Îª´ËÐèÒª½ûÓÃSliderµÄµã»÷ʼþ¡£

¹Ù·½API²¢Ã»ÓÐÌṩ½ûÓõã»÷ʼþµÄʼþµÄ·½·¨£¬Òò´ËҪʵÏÖÕâÒ»¹¦ÄÜÖ»ÄÜÁí±Ùõ辶¡£

ÁôÒâµ½µã»÷Sliderʱ¶¼Òª´¥·¢Ò»¸ömousedown·½·¨¸Ä±ä»¬¿éËù´¦µÄλÖ㬲»·ÁÖØдÕâ¸ö·½·¨£¬ÔÚmousedownʼþ´¥·¢Ê±£¬±£³ÖÔ­ÓеĻ¬¿éλÖò»±ä¡£

ʵÏÖ·½·¨

Ê×ÏÈÕÒµ½Òª²Ù×÷µÄ¶ÔÏó£º

ÕâÀïдͼƬÃèÊö

¿ØÖÆ´úÂ룺

/*** ¿ØÖÆ»¬¿éÈÎÒâλÖõã»÷ʼþ²»¿ÉÓÃ**/
function disableSliderTrack($slider) {
$slider.bind("mousedown", function (event) {
var x = event.pageX;
var y = event.pageY;
var $handle = $(this).find(".ui-slider-handle");
var left = $handle.offset().left;
var right = left + $handle.outerWidth();
var top = $handle.offset().top;
var bottom = top + $handle.outerHeight();
return (x >= left && x <= right && y >= top && y <= bottom);
});
}

ÔÚÒ³Ãæ¼ÓÔØʱ³õʼ»¯ËùÓл¬¿é¶ÔÏó

$(function(){
disableSliderTrack($(".ui-slider-track"));
});

ÖÁ´Ë´ó¹¦¸æ³É¡£ÌõÌõ´óµÀͨÂÞÂí£¬Í¨¹ýÖØд¿Ø¼þµÄmousedown·½·¨Ò²ÄÜʵÏÖ¶ÔclickʼþµÄ¡°½ûÓᱡ£

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • ¡¾Ðø¡¿×¥¸öFirefoxµÄС±è×Ó£¬jQuery±íʾ²»±³ÕâºÚ¹ø£¬Chrome,Edge,IE8-11¼ÌÐøΧ¹ÛÖÐ - ÈýÉúʯ

    ¡¾Ðø¡¿×¥¸öFirefoxµÄС±è×Ó£¬jQuery±íʾ²»±³ÕâºÚ¹ø£¬Chrome,Edge,IE8

    2017-12-01 12:15

  • æÇÃÀjQueryµÄJS¿ò¼Ü----AngularJS£¨¶þ£© - °×²Ë°×

    æÇÃÀjQueryµÄJS¿ò¼Ü----AngularJS£¨¶þ£© - °×²Ë°×

    2017-10-29 12:06

  • jQuery¶Ô±í¸ñµÄ²Ù×÷ - ±½±¦±¦

    jQuery¶Ô±í¸ñµÄ²Ù×÷ - ±½±¦±¦

    2017-08-20 16:03

  • jQuery.validate µÄformУÑé - ÄÇÒ»¿Ì~~~ÑÚ»¤Äã

    jQuery.validate µÄformУÑé - ÄÇÒ»¿Ì~~~ÑÚ»¤Äã

    2017-06-21 18:03

ÍøÓѵãÆÀ
æ