【发布时间】:2017-02-23 19:35:40
【问题描述】:
1:点击打开详情页
2:点击切换物品状态(真/假)并停留在本页
元素 2 位置:绝对及高于元素 1
当我单击元素 2 时,单击元素 1 上的事件触发并且页面重定向到详细信息页面,元素 2 没有触发事件。
这是我的设计和代码:
<div class="investment-content_image" ng-click="open(item.id)">
<div class="closed-overlay-fra">
<img class="closed-photo" ng-src="{{item.getClosedImage()}}" />
</div>
<div class="investment-content-closed" ng-if="!item.open" ng-class="{'active': hovering}" ng-click="open(item.id)">
<span class="investment-content-closed-text">SOLD OUT</span>
</div>
<label class="toggle-switch" ng-if="user.isAdvisor()" ng-click="updateHideInvestment()">
<input type="checkbox" ng-model="item.hide_investor">
<div class="switch-slider">
<span class="glyphicon glyphicon-ok"></span>
<span class="glyphicon glyphicon-remove"></span>
</div>
</label>
</div>
$scope.open = function (id) {
if (!$scope.user) {
return;
}
if ($scope.user.isAdmin()) {
$state.go('admin.showInvestment.overview', {investmentId: id});
} else if ($scope.user.isInvestor()) {
$state.go('investor.showInvestment.overview', {investmentId: id});
} else if ($scope.user.isAdvisor()) {
$state.go('advisor.showInvestment.overview', {investmentId: id});
}
};
$scope.updateHideInvestment = function () {
let data = {
id: $scope.item.id,
hide: $scope.item.hide_investor
};
advisorsSvc.updateHideInvestment(data)
.then((result) => {
$scope.item.hide_investor = result.hide_investor;
})
.catch((err) => { throw err; });
}
【问题讨论】:
-
请提供不适合您的 HTML 和当前代码。最好添加一个工作代码 sn-p 来演示问题。见 ►How to create a Minimal, Complete, and Verifiable example
-
任何代码都将不胜感激。
-
对不起,我已经更新了代码。
标签: javascript jquery html css angularjs