Make HTML5 video poster be same size as video itself
Depending on what browsers you’re targeting, you could go for the object-fit property to solve this: object-fit: cover; or maybe fill is what you’re looking for. Still under consideration for IE.
Depending on what browsers you’re targeting, you could go for the object-fit property to solve this: object-fit: cover; or maybe fill is what you’re looking for. Still under consideration for IE.
[DebuggerStepThrough] (docs)
I just managed to get the answer myself. By using the Obj-C Runtime Library, I had access to the properties the way I wanted: – (void)myMethod { unsigned int outCount, i; objc_property_t *properties = class_copyPropertyList([self class], &outCount); for(i = 0; i < outCount; i++) { objc_property_t property = properties[i]; const char *propName = property_getName(property); if(propName) … Read more
Stick an AttributeUsage attribute onto your Attribute class (yep, that’s mouthful) and set AllowMultiple to true: [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public sealed class MyCustomAttribute: Attribute
Old Way (pre-1.7): $(“…”).attr(“onclick”, “”).unbind(“click”); New Way (1.7+): $(“…”).prop(“onclick”, null).off(“click”); (Replace … with the selector you need.) // use the “[attr=value]” syntax to avoid syntax errors with special characters (like “$”) $(‘[id=”a$id”]’).prop(‘onclick’,null).off(‘click’); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js”></script> <a id=”a$id” onclick=”alert(‘get rid of this’)” href=”https://stackoverflow.com/questions/1687790/javascript:void(0)” class=”black”>Qualify</a>
The directive can access any attribute that is defined on the same element, even if the directive itself is not the element. Template: <div example-directive example-number=”99″ example-function=”exampleCallback()”></div> Directive: app.directive(‘exampleDirective ‘, function () { return { restrict: ‘A’, // ‘A’ is the default, so you could remove this line scope: { callback : ‘&exampleFunction’, }, link: … Read more
Attributes will take an array. Though if you control the attribute, you can also use params instead (which is nicer to consumers, IMO): class MyCustomAttribute : Attribute { public int[] Values { get; set; } public MyCustomAttribute(params int[] values) { this.Values = values; } } [MyCustomAttribute(3, 4, 5)] class MyClass { } Your syntax for … Read more
Rails CAN add custom attributes to select options, using the existing options_for_select helper. You almost had it right in the code in your question. Using html5 data-attributes: <%= f.select :country_id, options_for_select( @countries.map{ |c| [c.name, c.id, {‘data-currency_code’=>c.currency_code}] }) %> Adding an initial selection: <%= f.select :country_id, options_for_select( @countries.map{ |c| [c.name, c.id, {‘data-currency_code’=>c.currency_code}] }, selected_key = f.object.country_id) … Read more
When Inherited = true (which is the default) it means that the attribute you are creating can be inherited by sub-classes of the class decorated by the attribute. So – if you create MyUberAttribute with [AttributeUsage (Inherited = true)] [AttributeUsage (Inherited = True)] MyUberAttribute : Attribute { string _SpecialName; public string SpecialName { get { … Read more
No. Whenever implementing an interface or overriding members in a derived class, you need to re-declare the attributes. If you only care about ComponentModel (not direct reflection), there is a way ([AttributeProvider]) of suggesting attributes from an existing type (to avoid duplication), but it is only valid for property and indexer usage. As an example: … Read more