我目前正在开发一个使用ddslick jquery插件的网站。它允许图像与下拉选择菜单上的文本并排。问题是当我在本地运行它时,它可以工作,但不是当我将它上传到我的网站上时。我想知道是否有人遇到过这个错误,或者对我如何解决这个问题有所了解?谢谢。
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="index.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.1/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="ddslick.js"></script>
<link rel="stylesheet" type="text/css" href="register.css">
</head>
<body>
<section class="formRegister" ng-app >
<form class="form-inline" name="formRegister" id="register" action="home.php" method="post" >
<h2> Register </h2>
<p> Welcome </p>
<p class="errorValidation" ng-show="formRegister.fullname.$invalid && formRegister.fullname.$touched">Please enter your name </p>
<div class="form-group">
<input type="text" class="form-control" id="fullName" name="fullname" placeholder="Full Name" ng-model="user.fullname" ng-required="true">
</div> <br> <br>
<p class="errorValidation" ng-show="formRegister.email.$invalid && formRegister.email.$touched">Please enter a valid email address </p>
<div class="form-group">
<input type="email" class="form-control" id="email" name="email" placeholder="Email" ng-model="user.email" ng-required="true">
</div> <br> <br>
<p class="errorValidation" ng-show="formRegister.passwordR.$invalid && formRegister.passwordR.$touched">Password must be at least 8 characters</p>
<div class="form-group">
<input type="password" class="form-control" id="initialPassword" name="passwordR"
placeholder="Enter Password" ng-model= "user.password" ng-required="true" ng-minlength="8">
</div> <br> <br>
<div id="myDropdown"></div>
<select id="schools">
<option value="0" data-imagesrc="brown.gif" data-description="Brown University">Brown University</option>
<option value="1" data-imagesrc="dartmouth.gif"data-description="Dartmouth University">Dartmouth University</option>
<option value="2" data-imagesrc="drexel.gif"data-description="Drexel University">Drexel University</option>
<option value="3" data-imagesrc="georgemason.gif" data-description="George Mason University">George Mason University</option>
<option value="4" data-imagesrc="georgiatech.gif" data-description="Georgia Tech">Georgia Institute of Technology</option>
<option value="5" data-imagesrc="georgewashington.gif" data-description="George Washington University">George Washington University</option>
<option value="6" data-imagesrc="georgetown.gif" data-description="George Town">George Town University</option>
<option value="7" data-imagesrc="ncstate.gif" data-description="North Carolina State University">North Carolina State University</option>
<option value="8" data-imagesrc="nyu.png" data-description="New York University">New York University</option>
<option value="9" data-imagesrc="harvard.gif" data-description="Harvard University">Harvard University</option>
<option value="10" data-imagesrc="northeastern.gif" data-description="Northeastern University">Northeastern University</option>
<option value="11" data-imagesrc="ohiostate.gif" data-description="Ohio State University">Ohio State University</option>
<option value="12" data-imagesrc="purdue.gif" data-description="Purdue University">Purdue University</option>
<option value="13" data-imagesrc="townson.jpg" data-description="Townson University">Townson University</option>
<option value="14" data-imagesrc="upenn.gif" data-description="University of Pennsylvania"> University of Pennsylvania</option>
<option value="15" data-imagesrc="utexasdallas.jpg" data-description="University of Texas - Dallas"> University of Texas - Dallas</option>
<option value="16" data-imagesrc="uva.gif" data-description="University of Virginia">University of Virginia</option>
<option value="17" data-imagesrc="sandiego.jpg" data-description="University fo San Diego"> University fo San Diego</option>
<option value="18" data-imagesrc="vanderbilt.gif" data-description="Vanderbilt University">Vanderbilt University</option>
<option value="19" data-imagesrc="vatech.gif" data-description=" Virginia Polytechinic Institute and State University">Virginia Polytechinic Institute and State University</option>
<option value="20" data-imagesrc="yale.gif" data-description=" Yale University">Yale University</option>
</select>
<br />
<button type="submit" name="submit" class="btn btn-default">Register</button>
</form>
</section>
<script type="text/javascript">
$(document).ready( function(){
$('#schools').ddslick();
});
</script>
</body>
</html>
答案 0 :(得分:0)
问题是:
it('a ctrl with $timeout inside', inject(function($timeout) {
var myCOntroller = $controller('Controller', { $scope: $scope });
// flush timeout(s) for all code under test.
$timeout.flush();
// this will throw an exception if there are any pending timeouts.
$timeout.verifyNoPendingTasks();
expect($scope.result).toBe("whatIexpect");
}));
// with your example
it('should pass', (done) => {
$timeout(50)
.then(() => {
// this is never called
expect(1).toBe(1);
})
.finally(done);
$timeout.flush();
});
我假设你在服务器中有这个...如果不是这就是问题,另一件事就是你必须改变它正确生根的路径: <script type="text/javascript" src="ddslick.js"></script>