" U"元素内的属性 [英] "u" property within an element

查看:109
本文介绍了" U"元素内的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



但是,我正在运行一个JSSOR Slider我的网站和一些元素有au属性,例如:

 < div u =slidesstyle =cursor: move; 
position:absolute; left:0px; top:0px; width:
1300px; height:500px; overflow:hidden;>

这个u = slides在我通过W3 Validator运行时会产生一个错误,当我从元素中移除该属性时,滑块不再起作用。



我想知道这个属性的用途,因为我看不到任何地方的标记,并且想知道是否它可以代替任何东西,以使网站通过标记验证。



预先感谢。

解决方案

自定义属性(在HTML5中)可以使用 data - * 前缀

 < elem data-u =幻灯片>< / elem> 

然而,这里的问题在于,开发这个JSSOR Slider插件的人决定不使用有效的HTML5标记。除非插件的JavaScript代码被修改为查找 data - * 属性而不是名为u的无效属性,否则您将无法修改此属性而不破坏方式您的网站的功能。






更新:深入挖掘我发现这已经是在1月份作为JSSOR的GitHub存储库问题提出: https://github.com/jssor / jQuery的滑块/问题/ 4 。他们通过允许您使用有效的 data-u 属性而不是 u 来纠正这个问题。



解决方案



如果您的JSSOR插件代码是最新的。您可以简单地修改您的HTML:

 < div data-u =slidesstyle =...> ; 


Since I cannot search for this with meaningful results, I can't be sure that this is not a duplicate.

However, I am running a JSSOR Slider on my site and some of the elements have a u property for example:

<div  u="slides" style="cursor: move;
position: absolute; left: 0px; top: 0px; width:
1300px; height: 500px; overflow: hidden;">

This "u=slides" is throwing up an error when I run it through a W3 Validator, however when I remove this property from the element, the slider no longer functions.

I am wondering the purpose of this property as I see no markup for it anywhere, and wondering if it can be substituted for anything in order to make the site pass markup validation.

Thanks in advance.

解决方案

Custom attributes (in HTML5) can be assigned to elements using the data-* prefix:

<elem data-u="slides"></elem>

The problem here, however, is that whoever developed this JSSOR Slider plugin has decided not to use valid HTML5 markup. Unless the plugin's JavaScript code is modified to look for a data-* attribute rather than an invalid attribute named "u", you will not be able to modify this attribute without breaking the way your site functions.


Update: Digging deeper I've discovered that this was already raised as an issue on JSSOR's GitHub repository back in January: https://github.com/jssor/jquery-slider/issues/4. They've rectified this by allowing you to use a valid data-u attribute instead of u.

The Solution

Provided your JSSOR plugin code is up to date. You can simply modify your HTML to:

<div data-u="slides" style="...">

这篇关于&QUOT; U&QUOT;元素内的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆