如何在scss中自动检测li标签的数量(How to auto detect number of li tag in scss)
我正在这样写标题的navi。
<div id="navi"> <ul class="menu"> <li>Item1</li> <li>Item2</li> <li>Item3</li> <li>Item4</li> <li>Item5</li> </ul> </div>
这是scss文件。
$navi_items: 5; #navi{ width: $page_width; margin: 0 auto; ul.menu{ li{ padding:10px; width: $page_width/$navi_items - 20 ; float:left; } } }
当我在导航中添加新项目时,我必须更改
$navi_items
值。 是否可以自动检测li的数量并将其反映在scss中?我知道我可以用javascript做到这一点。 但我想知道如何用scss做到这一点。
I'm writing navi in header like this.
<div id="navi"> <ul class="menu"> <li>Item1</li> <li>Item2</li> <li>Item3</li> <li>Item4</li> <li>Item5</li> </ul> </div>
And this is scss file for it.
$navi_items: 5; #navi{ width: $page_width; margin: 0 auto; ul.menu{ li{ padding:10px; width: $page_width/$navi_items - 20 ; float:left; } } }
When I add new item in navigation I must change
$navi_items
value. Is it possible to detect number of li automatically and reflect it in scss?I know I can do it with javascript. But I want to know how to do it with scss.
原文:https://stackoverflow.com/questions/18805717
最满意答案
您需要创建一个新的WP7项目。 可能有一种方法可以编辑项目和解决方案文件,但只需创建一个新的WP7项目并将现有的代码添加到t即可。
顺便说一句。 你应该以相反的方式做到这一点,从WP7开始,只有当你需要WP8中的(很少)新功能时才将项目升级到WP8。
You need to create a new WP7 project. There may be a way to edit you project and solution files but it would be quicket to just create a new WP7 project and add your existing code to t.
Btw. you should do it the other way around, start with WP7 and upgrade the project to WP8 only if you need the (very few) new features in WP8.
相关问答
更多-
哈哈,我刚才发现了原因! WP8不再支持Clipboard.SetText,它会崩溃应用程序。 Haha, I just found out the reason! Clipboard.SetText is not supported on WP8 anymore and it crashes the app.
-
Windows Phone 8引入了更高分辨率的屏幕(768x1280和720x1280)。 这相当于WP7的1.6倍像素数。 因此,为了确保图像在较高分辨率的手机上看起来很好,图标需要更高分辨率的图像。 Windows Phone 8 introduced higher resolution screens (768x1280 and 720x1280). This is up to 1.6x pixel count of WP7. So to make sure the images look good ...
-
共享WP7和WP8的代码库(Share code base for WP7 and WP8)[2023-07-12]
如何组织应用程序结构,选择合适的方法。 那么,MVVM在使用Windows Phone时总是很受欢迎。 任何良好的清洁结构,遵循固体原则将会很好。 Windows Phone 8将支持新的C#5.0语言功能,因此如果您有很多异步代码,请考虑使用适用于Windows Phone 7的Windows Phone任务并行库 ,因为所有返回任务的调用都将支持C#5.0中的新await运算符。 Windows Phone 8中最重要的变化是新的更好的控制。 如果你想用相同的代码库支持这两个平台,你想尝试尽可能地从应用 ... -
使WP8应用程序与WP7兼容(Make WP8 app compatible with WP7)[2022-08-11]
您需要创建一个新的WP7项目。 可能有一种方法可以编辑项目和解决方案文件,但只需创建一个新的WP7项目并将现有的代码添加到t即可。 顺便说一句。 你应该以相反的方式做到这一点,从WP7开始,只有当你需要WP8中的(很少)新功能时才将项目升级到WP8。 You need to create a new WP7 project. There may be a way to edit you project and solution files but it would be quicket to just cr ... -
您必须创建一个以7.1为目标的新项目。 WP7.x应用程序可以在WP8设备中运行,但不能以其他方式运行。 创建项目时,您的目标是7.1。 如果您安装了最新的SDK,WP7.8功能将可用。 您可以通过从NuGet添加Microsoft.Bcl.Async包 You have to create a new project targeting 7.1. WP7.x apps can run in WP8 devices, but not in the other way. When createing the ...
-
如果我遇到你的问题, 这是我的答案。 XNA没有页面的概念。 如果您需要“导航”,则必须在WP7项目中使用Silverlight。 否则,如果你不能使用Silverlight,你必须实现你的“页面”类来管理你需要的东西(按钮和检测触摸),然后,当你想要启动GamePage你只需要调用它,隐藏或停用菜单课。 当然,每个页面都必须从DrawableGameComponent继承。 If I get your problem, here is my answer. XNA hasn't the concept o ...
-
文件>新建项目> Visual C#> Windows应用商店应用> Windows Phone应用>空白应用(适用于Windows Phone的Silverlight应用) 插入项目名称,然后单击确定! Visual Studio会提示您在8.0或8.1之间进行选择! 选择8.0,完成! ;) File > New Project > Visual C# > Windows Store Apps > Windows Phone Applications > Blank App(Silverlight Ap ...
-
您可以尝试仅打开所有功能并查看是否可以修复它。 如果是这样,你可以开始关闭你不需要的。 You might try just turning all the Capabilities on and seeing if that fixes it. If it does, you can start turning off ones you don't need.
-
据我所知: 如果你的应用程序是针对WP7的,那么除非你没有为后者提供单独的软件包,否则它肯定可用于WP8和WP8.1。 所以你的第一个问题的答案是肯定的 你说过考虑针对WP8的8.1 sdk但是在此之前探讨一下 - 这样做是否真的值得或富有成效,因为WP8.1的新功能将无法用于WP8,所以是什么促使你这样做。 正如您已经提到的,WP8.1设备非常少。 我认为这不应该是做出决定的重点。 您的决定应该取决于 - 您是否将在您的应用程序中使用WP8.1的新功能。 如果你这样做,你也应该针对WP8.1。 因为最终每 ...
-
我相信检查MediaPlayer.GameHasControl是你正在寻找的。 使用该属性和MediaPlayer的其他成员来满足应用程序认证准则6.5.1以下是@ http://henry-chong.com/2012/02/pro-tip-including-background-music的端到端示例-因为,你的窗口,电话应用程序/ 如果您的应用是音乐+视频应用,BTW,6.5.x应用认证要求不适用。 这是解决6.5.1 :)的一种方法 I believe checking for MediaPlay ...