zoukankan      html  css  js  c++  java
  • 练手代码记录

    1. 移动页面滑动刷新出现loading spinner

      js:

    		$scope.loadInProcessIssue = function() {
    
    			if (angular.isUndefined($scope.inProcessIssues) || $scope.inProcessIssues.length <= 0) {
    				doSearch();
    			} else {
    				$scope.loading = true;
    				var promise = $timeout(700);
    				promise.then(function(data) {
    					doSearch();
    					$scope.loading = false;
    				})
    			}
    			
    		};
    		
    		function doSearch() {
    			
    			if (angular.isUndefined($scope.isLastPage) || $scope.isLastPage == false) {
    				Issue.queryIssueInProcess({page: $scope.pageInfos.number, size: $scope.pageInfos.size}, function(response) {
    					if (response.last == false) {
    						$scope.pageInfos.number++;
    					} else {
    						$scope.isLastPage = true;
    					}
    					refreshContent(response);
    				});
    			} else {
    				showMessage('没有更多了');
    			}
    			
    		}
    		
    		function refreshContent(data) {
    			if (angular.isUndefined($scope.inProcessIssues)) {
    				$scope.inProcessIssues = [];
    			}
    			angular.forEach(data.content, function(issue) {
    				$scope.inProcessIssues.push(issue);
    			});
    		}
    

      html:

    <div ng-show="loading" class="mobile-content-loading">
                    <i class="fa fa-spinner fa-spin loading-spinner" style="margin-top: -20px;font-size: 25px;"></i>
      </div>

     2. 使用angular的$drag服务拖动任意元素

    emmsMobile.directive('mobileSectionDragArea', ['$drag', '$document', function($drag, $document) {
    		
    		function turnOnLoadingIcon() {
    			$document.find('.scrollable-content').css('background-color', '#eee');
    			$document.find('#smallLoadingIcon').css('display', 'block');
    		}
    		
    		function turnOffLoadingIcon() {
    			$('#smallLoadingIcon').fadeOut(500);
    		}
    		
    		  return {
    		    controller: function($scope, $element) {
    		      $drag.bind($element,
    		        {
    		          transform: $drag.TRANSLATE_VERTICAL,
    		          start: function(drag) {
    		        	 turnOnLoadingIcon();
    		        	 $scope.dragRefresh();
    		          },
    		          end: function(drag) {
    		            drag.reset();
    		            turnOffLoadingIcon();
    		          }
    		        },
    		        {
    		          sensitiveArea: $element.parent()
    		        }
    		      );
    		    }
    		  };
    
    		
    	}]);
    

      3. 实现右下角固定亮哥按钮: 

     

    代码:

    <div ng-if="currentIssue.level.id == 1" class="pull-right"  style="padding: 10px;position: fixed;bottom: 6vh;right: 0vh">
            <table>
                
                <tr>
                    <td>
                        <a class="btn btn-sm" ng-click="showLocationNear()" style="border: none;border-radius: 25px">
                            <img class="img-circle img-responsive user-nearby" src="img/nearby.png" />
                        </a>
                    </td>
                </tr>
              
                <tr>
                    <td>
                        <a class="btn btn-sm" ng-click="showEmergencyGroup()" style="border: none;border-radius: 25px">
                            <img class="img-circle img-responsive user-nearby" src="img/emergency.png" />
                        </a>
                    </td>
                </tr>
            </table>
        </div>

     3. 使用ui-bootstrap的colleapse折叠器

    // 关键代码
    uib-collapse="Ui.isActive('userLevels')"
  • 相关阅读:
    ch4-SPSS Statistics操作进阶
    ch3-SPSS Statistics操作入门
    概率论与数理统计-ch7-参数估计
    概率论与数理统计-ch6-样本与抽样分布
    概率论与数理统计-ch5-大数定律及中心极限定理
    概率论与数理统计-ch4-随机变量的数字特征
    概率论与数理统计-ch3-多维随机变量及其分布
    Maven的依赖冲突
    eclipse下的server插件
    JQuery了解
  • 原文地址:https://www.cnblogs.com/nelson-hu/p/7832329.html
Copyright © 2011-2022 走看看