Ignore:
Timestamp:
2015-02-09T12:11:28+13:00 (9 years ago)
Author:
bmt11
Message:

Tooltip is now polished and finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/render-3d/Flag_files/slider.js

    r29719 r29721  
    22   
    33    var initialValue = 100;
    4     var curValue = initialValue;
    5     var tooltip = 'Wind Speed: '+curValue+'';
     4    var tooltip = '<span class="tt"><span class="text">'+getDescript(initialValue)+'</span></span>';
     5    var target;
    66   
    77    $("#speed").slider({
     
    2020   
    2121    function initTooltip(ui){
    22         tooltip = 'Wind Speed: '+curValue+'';
    23         var target = ui.handle || $('.ui-slider-handle'); 
    24         $(target).html(tooltip);
     22        target = ui.handle || $('.ui-slider-handle'); 
    2523    }
    2624   
    2725    function setSpeed(ui){
    2826        windStrength = ui.value;
    29         curValue = ui.value;
    30         tooltip = 'Wind Speed: '+curValue+'';
    31         target = ui.handle || $('.ui-slider-handle');
    32         $(target).html(tooltip);       
     27        tooltip = '<span class="tt"><span class="text">'+getDescript(ui.value)+'</span></span>';
     28        target = ui.handle || $('.ui-slider-handle');
     29        $(target).html(tooltip);       
     30    }
     31   
     32    function getDescript(speed){
     33        if(speed < 50) return 'calm';
     34        if(speed < 100) return 'light';
     35        if(speed < 150) return 'fair';
     36        if(speed < 200) return 'heavy';
     37        return 'gusty';
    3338    }
    3439   
    3540    $(".ui-slider").mouseenter(function(){
    3641        controls.enabled = false;
     42        $(target).html(tooltip);
    3743    });
    3844   
    3945    $(".ui-slider").mouseleave(function(){
    4046        controls.enabled = true;
     47        $(".tt").remove();
    4148    });
    4249
Note: See TracChangeset for help on using the changeset viewer.