How can I set -webkit-mask-box-image through javascript?
Tags: javascript,css,webkit,mask
Problem :
I have a div with id="container'
that I want to set a -webkit-mask-box-image
for. Currently I have this through css:
#container
{
-webkit-mask-box-image: url('masks/4.png');
width:235px;
height:300px;
}
But I want to set the css through javascript, because the mask should change each hour.
I have tried:
document.getElementById("container").setAttribute("style", "-webkit-mask-box-image: url('masks/"+hour+".png'); width:235px; height:300px;");
But that doesn't work. How do I do it?
Solution :
you can set in JQuery by below Line of Code, Here is DEMO
$('#container').css('-webkit-mask-box-image',"url('masks/4.png')")
CSS Howto..
You can use display: inline-block instead of display: inline ul { list-style-type: none; margin: 0; padding: 0; } ul li { display: inline-block; } <ul> <li><a href="/">Home </a></li> <li> <p>|</p>...
transition will apply the moment you load the page so that is not an ideal solution in your situation, what you will need is CSS @keyframes where you need to...
Thank you, the solution i've found that work form me is similar to your #section_to_print a[href]:after { display:none; } In fact, the problem was generated by some css containing a...
Just remove display: inline-block !important; from .list-unstyled li and give display: flex; flex-wrap: wrap; to .list-unstyled will make it as your expected result. .list-unstyled { background-color: #eee; width: 100%; display:...
Try something like this with jQuery.. /// you probably want to set this dynamically var change1 = 200; $(document).scroll(function() { // you might need to throttle the listener if (Math.random()...
You can use <figure> and <figcaption>: <figure> <img /> <figcaption>Image</figcaption> </figure> And give the parent element, text-align: center;. Snippet .center {text-align: center;} <div class="center"> <figure> <img src="http://placehold.it/250?text=IMG" alt="">...
body { margin:0 auto; width:940px; } #headercontainer { left:0; } If you loose the background image this way, give the background image to the html instead of the body....
I think that using flexbox would be the best thing; if you want support for lesser browsers, you could do something like this: #content{background:green;width:100%;} #sidebar-right, #sidebar-left{ background:pink; width:50%;float:left; } @media...
Using display: table; it cannot be done (cause sadly there's no colspan: 3; or rowspan property in CSS, therefore stylesheet is unable to mimick a real <table> element) but hey,...
#slider { white-space: nowrap; overflow : hidden; width : 100% } ...
or use \25BC div:after { content: '\25BC'; } <div></div> ...
You can do these three things: Add text-align:center; to .header_middle_menu Remove float: left; from .header_middle_menu li Change display: inline; to display: inline-block; in .header_middle_menu ul li jsFiddle example...
You should use Web Part Resources which can be linked or embedded. This article does a good job of explaining how to use them: Best Practices for Managing Web Part...
1. Is there a replacement for aural? Aural stylesheets have indeed been deprecated as of CSS3. Major browsers such as Firefox removed the implementation a while ago. There is still...
I came up with this solution using simple markup and CSS. The Codepen includes animation examples, in case this is a progress kind of thing. Codepen: http://codepen.io/jpecor-pmi/pen/GZNPWO HTML <section id="circles">...
Find all occurences of quick and wrap them intp a specific element (e.g. <del>) hidden via css CSS p del { display: none; } jQuery $('p').each(function() { var $this =...
I realised with this that the images on ornamento.com are not full width. Stretch your browser as wide as you can, you'll see ;-) The best option is to use...
The problem you have here is that anything that is position: absolute; is removed from flow. Thus, #container can never contain the .boxes. In this cause you will need to...
transform: translateY(-100%) And make sure you use WebKit, and moz if needed...
For young browser you may use : 1) display:flex; property (includes centering) DEMO .backdrop { position: fixed; top:0; } .backdrop { width: 100%; height: 100%; z-index: 100; background-color: rgba(0, 0,...
It shows you how to achieve this in the link that you included .on-top { position: absolute; width: 100%; text-align: center; } .animate { -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-fill-mode: both;...
I would do it as follows: I would add the following rule to the CSS file being used in the theme under your usage: .fs30 { font-size: 30px; font-weight: bold;...
Change your span class or add one like this : <span class="rect"> <span class="otherrect rect"></span> </span> ...
If it's in a compressed folder, your friend will need to extract the folder for each file to be able to use eachother. Or, if your friend isn't that tech-savvy,...
Give your h1 label a class, such as "Rainbojangles": <h1 class="Rainbojangles">Award Winners Only</h1> Include that class in your Site.css (or other CSS) file: .Rainbojangles { color: white; font-size: 2em; font-family:...
You can remove all the unwraped elements like this, $('.span9').html($('.span9').children()); Fiddle...
How to write function in css? I know that possible with SCSS; Is their any way with which i can achieve this in css? The answer is No. CSS...
FireFox posted a resolution to this today on their bug forum. It was just finalized today so won't be in use for a while, but we should all put -webkit-font-smoothing:...
You need to reset the active element of the carousel every time you open a modal window. Try to add this code at the end of your page: <script> $(".modal").on('show.bs.modal',...
jQuery UI 1.9 Milestone 1 includes a working version of Tooltip built into the library. The announcement includes usage examples. If you're going to use jQuery UI 1.9, the latest...