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')"
  • 相关阅读:
    计算机网络——TCP如何做到可靠数据传输
    计算机网络——TCP的流水线传输(超详细)
    计算机网络——TCP的拥塞控制(超详细)
    计算机网络——TCP的三次握手与四次挥手(超详细)
    计算机网络——多路复用与多路分解
    转:资源 | 我爱自然语言处理
    bootsect及setup
    python默认编码设置
    实例分析C程序运行时的内存结构
    matlab常用目录操作
  • 原文地址:https://www.cnblogs.com/nelson-hu/p/7832329.html
Copyright © 2011-2022 走看看