change linear bagckgorund by javascript
// Detect which browser prefix to use for the specified CSS value
// (e.g., background-image: -moz-linear-gradient(...);
// background-image: -o-linear-gradient(...); etc).
//
function getCssValuePrefix()
{
var rtrnVal = '';//default to standard syntax
var prefixes = ['-o-', '-ms-', '-moz-', '-webkit-'];
// Create a temporary DOM object for testing
var dom = document.createElement('div');
for (var i = 0; i < prefixes.length; i++)
{
// Attempt to set the style
dom.style.background = prefixes[i] + 'linear-gradient(#000000, #ffffff)';
// Detect if the style was successfully set
if (dom.style.background)
{
rtrnVal = prefixes[i];
}
}
dom = null;
delete dom;
return rtrnVal;
}
// Setting the gradient with the proper prefix
dom.style.backgroundImage = getCssValuePrefix() + 'linear-gradient('
+ orientation + ', ' + colorOne + ', ' + colorTwo + ')';
Also in JavaScript:
- how to use reduce in javascript
- cache buster in angular application
- how to add oAuth google signin in react native app
- how to change zoom in and zoom out button position in google map
- expo open app settings
- js delete all array items
- javascript turn string into array
- enzynme not support react 17
- nodejs self quit program
- angular limit string length
- how to add role in discord.js v12
- javascript format price
- jquery validate conditional
- react $ r component instance console
- react start new app
- two dimensional array in javascript example code
- two object combine together javascript
- javascript add item to list
- javascript uppercase first character of each word
- how to check if window size of browser s changed javascript
- pop javascript
- async await in forloops
- jquery google cdn
- how to pass dynamic string in string javascript