gpt4 book ai didi

javascript - 如何正确使用显示: inline with ng repeat

转载 作者:行者123 更新时间:2023-11-28 01:17:57 25 4
gpt4 key购买 nike

我想制作一个时间轴,但它的结构已损坏。我认为这是因为 display:inline,如果我尝试对我的网站这样做:

enter image description here

它会破坏它:

enter image description here

显示内联 block 也让它变得有趣。

我尝试将 display: inline 到包含时间轴的 overall div,但没有成功。然后我对时间轴中的所有 div 都这样做了,但也没有用。

时间线:

<span class = "timelinefull">
<div ng-controller="MainController">
<div class="timeline">
<!-- ANCHOR DOT -->
<div class= "dot">
<div ng-mouseover="infoIsVisible = true" ng-mouseleave="infoIsVisible = false" ng-mouseover="getCoords(event)">
<img class="icon" ng-src="img/icon_dot.png" height="30px" width="30px">
</div>
<div class="info label label-info" id="info" ng-show="infoIsVisible">
<p>Was born</p>
</div>
</div>

<!-- REST OF MY DOTS -->

<div class="dot" ng-repeat="timelineEvent in timelineEvents">
<timeline-info info="timelineEvent"></timeline-info>
</div>
</div>
</div>
</span>

ng-repeat 模板:

<div class="timeline-inner" ng-init="infoIsVisible= false">
<img class="line" src="components/timeline/template-timeline/img/line.png" height="5px" width="{{ info.months }}">
<div ng-mouseover="infoIsVisible = true" ng-mouseleave="infoIsVisible = false" ng-mouseover="getCoords(event)">
<a href="{{ info.link }}">
<img class="icon" id="icon" ng-src="{{ info.icon }}" height="30px" width="30px">
</a>
</div>
</div>

<div class="info label label-info" id="info" ng-show="infoIsVisible">
<p>{{ info.description }}</p>
<p style="font-size: 8px"> Click for more info </p>
</div>

CSS

.timelinefull {
display: inline;
}

.timeline-inner {
display: inline;
}

.info {
display: inline;
padding-top: 10px;
position: absolute;
z-index: 100;
-webkit-transition:all linear 0.3s;
transition:all linear 0.3s;
}

.line {
box-shadow: 0 0 0 2px rgba(0,0,0,.05);
margin-left: -5px;
margin-right: -5px;
}

.info.ng-hide {
opacity:0;
}

a:link {
text-decoration: none;
}

感谢您的帮助!

最佳答案

尝试这种方式:

试试这个

<div ng-repeat="friend in friends" style="float:left">
{{friend.name}} who is {{friend.age}} years old.
</div>

<span ng-repeat="friend in friends">
{{friend.name}} who is {{friend.age}} years old.
</span>

默认 DIV 呈现为 display:blockSPAN 呈现为 display:inline-block

<span class="col-sd-4" ng-repeat="it in elem.tags">

关于javascript - 如何正确使用显示: inline with ng repeat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35006164/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com