Remove an object from scene - three.js

my problem is that i have buttons : "view" button that enable OrbitControls , "move" button that disable OrbitControls so i can use DragControls, "cube" button that add a cube (or many cubes) to the scene and everything works fine, but when i added a "remove" button so i can remove the cube, it didnt work it says that the cube is not defined. So what should i do ? `
//variables :
var objects = [];
//scene
var scene = new THREE.Scene();
scene.background = new THREE.Color( 0xf0f0f0 );
//camera
var camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
//renderer
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
//adding light
scene.add( new THREE.AmbientLight( 0x0f0f0f ) );
var light = new THREE.SpotLight( 0xffffff, 1 );
light.position.set( 0, 500, 2000 );
scene.add(light);
//controls
const orbitControls = new THREE.OrbitControls( camera, renderer.domElement );
const dragControls = new THREE.DragControls( objects, camera, renderer.domElement );
//fix the window resize problem
window.addEventListener('resize', function(){
renderer.setSize(window.innerWidth,window.innerHeight) ;
camera.aspect = window.innerWidth / window.innerHeight ;
camera.updateProjectionMatrix();
}) ;
//animate
function animate() {
requestAnimationFrame( animate );
renderer.render(scene, camera);
};
//cloning
function createCube () {
var geometry = new THREE.BoxGeometry( 120, 120, 120 );
var cube = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0x00004B } ) );
scene.add( cube );
objects.push( cube );
cube.position.x = 0;
cube.position.y = -30;
}
function createRockCube() {
var texture = new THREE.TextureLoader().load( 'rock.jpg' );
var rock_geometry = new THREE.BoxGeometry( 120, 120, 120 );
var rock_material = new THREE.MeshBasicMaterial( {map: texture} );
var rock_cube = new THREE.Mesh( rock_geometry, rock_material );
scene.add( rock_cube );
objects.push( rock_cube );
rock_cube.position.x = -200;
rock_cube.position.y = -30;
}
function createRobot() {
var objLoader = new THREE.OBJLoader();
objLoader.setPath('/examples/3d-obj-loader/assets/') ;
objLoader.load('r2-d2.obj', function (object) {
object.position.x = 500 ;
object.position.y = -100 ;
object.traverse( ( o )=> {
if ( o.isMesh ) objects.push( o );
} );
scene.add(object);
}) ;
}
function createRobot2() {
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath('/examples/3d-obj-loader/assets/') ;
mtlLoader.load('r2-d2.mtl', (materials)=> {
materials.preload();
var objLoader2 = new THREE.OBJLoader();
objLoader2.setMaterials(materials);
objLoader2.setPath('/examples/3d-obj-loader/assets/') ;
objLoader2.load('r2-d2.obj', (object2) =>{
object2.position.x = 300 ;
object2.position.y = -100 ;
object2.traverse( ( o ) => {
if ( o.isMesh ) objects.push( o );
} );
scene.add(object2);
});
})
}
function disableControl(){
orbitControls.enabled = false;
}
function enableControl(){
orbitControls.enabled = true;
}
function removeCube () {
cube.geometry.dispose();
cube.material.dispose();
scene.remove(cube);
}
animate();
body {
margin: 0px;
background-color: rgb(240, 240, 240);
}
canvas {
width: 100%;
height: 100vh ;
position: absolute;
}
/* objects buttons */
#btn-cube {
background-color: rgb(0, 0, 75);
position: absolute;
left: 70px;
height: 50px;
width: 100px;
cursor: pointer;
}
#rock-btn img {
position: absolute;
top: 75px;
left: 70px;
height: 50px;
width: 100px;
cursor: pointer;
}
#robot-btn {
position: absolute;
left: 70px;
height: 50px;
width: 100px;
cursor: pointer;
}
#robot2-btn {
position: absolute;
top: 55%;
left: 70px;
height: 50px;
width: 100px;
cursor: pointer;
}
#move-btn {
position: absolute;
top: 90%;
left: 55%;
height: 50px;
width: 100px;
background-color: Transparent;
background-repeat:no-repeat;
border: none;
cursor:pointer;
overflow: hidden;
font-size: 20px;
font-family: cursive;
}
#view-btn {
position: absolute;
top: 90%;
left: 45%;
height: 50px;
width: 100px;
background-color: Transparent;
background-repeat:no-repeat;
border: none;
cursor:pointer;
overflow: hidden;
font-size: 20px;
font-family: cursive;
}
/*menu*/
nav {
width: 250px;
position: absolute;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.1);
border-radius: 10px;
box-shadow: 5px 7px 10px rgba(0, 0, 0, 0.5);
transition: 0.3s ease;
}
nav ul {
position: relative;
top: 50px;
list-style-type: none;
}
nav ul li a {
display: flex;
align-items: center;
font-family: cursive;
font-size: 20px;
text-decoration: none;
text-transform: capitalize;
color:black;
padding: 10px 30px;
height: 50px;
transition: 0.5s ease;
}
nav ul li a:hover {
cursor: pointer;
color: #fff;
}
nav ul .cubes {
position: absolute;
left: 250px;
width: 200px;
top : 0;
display: none;
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
background: rgba(0, 0, 0, 0.1);
}
nav ul .robots {
position: absolute;
left: 250px;
width: 200px;
top : 80;
display: none;
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
background: rgba(0, 0, 0, 0.1);
}
nav ul span {
position: absolute;
right: 20px;
font-size: 20px;
}
nav ul .dropdown:hover ul{
display: initial;
}
nav ul .dropdown2:hover ul{
display: initial;
}
#open-btn {
display: none;
position: absolute;
top: 12px;
cursor: pointer;
font-size: 30px;
}
.close-btn {
position: absolute;
top: 10px;
right: 5px;
cursor: pointer;
font-size: 36px;
color: rgb(66, 64, 40);
}
#remove-btn {
position: absolute;
top: 90%;
left: 30%;
height: 50px;
width: 100px;
background-color: Transparent;
background-repeat:no-repeat;
border: none;
cursor:pointer;
overflow: hidden;
font-size: 20px;
font-family: cursive;
}
<html>
<head>
<title>Kitchen Planner Ama Mn Jumia </title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<script src="./three.min.js"></script>
<script src="./DragControls.js"></script>
<script src="./OrbitControls.js"></script>
<script src="./OBJLoader.js"></script>
<script src="./MTLLoader.js"></script>
<script src="./app.js"></script>
<script src="./menu.js"></script>
<nav id="menu" >
<div id="open-btn" onclick="openFunction()"> ☰ </div>
×
<ul>
<li id="dropdown" class="dropdown">Cubes <span>›</span>
<ul class="cubes">
<li><button id="btn-cube" onclick="createCube()"></button>
<li><button id="rock-btn" onclick="createRockCube()" ><img src="./rock.jpg"></button>
</ul>
</li>
<li id="dropdown2" class="dropdown2">Robots <span>›</span>
<ul class="robots">
<li><button id="robot-btn" onclick="createRobot()"> Robot </button>
<li><button id="robot2-btn" onclick="createRobot2()"> Robot 2 </button>
</ul>
</li>
</ul>
</nav>
<button id="move-btn" onclick="disableControl()">move</button>
<button id="view-btn" onclick="enableControl()"> view </button>
<button id="remove-btn" onclick="removeCube()"> remove </button>
</body>
</html>
`

You have to declare your cube variable outside of createCube(). It's then in a scope that can be accessed by removeCube().

Related

Next Js with SCSS not applied in production (built-mode)

I have problem with some parts of my spinning-wheel component in built-mode when I deploy my application to server.I have no issue if I run the code locally with "npm run dev", but the problems come when run the code with "npm run build" and "npm start".
Here is the snapshots of development mode (picture 1) and built mode (picture 2):
And this is the scss file I used :
.board-arisan-container {
--wheel-size: 300px;
--wheel-slice-spacing: 50px;
--wheel-border-size: 5px;
--wheel-color: #ffad00;
--neutral-color: #ffffff;
--PI: 3.60;
--nb-item: 0;
--item-nb: 0;
--selected-item: 0;
--nb-turn: 5;
--spinning-duration: 4s;
--reset-duration: 0.25s;
transform: rotate(-90deg);
.wheel-container {
display: block;
position: relative;
box-sizing: content-box;
width: calc(var(--wheel-size) + 2 * var(--wheel-border-size));
height: calc(var(--wheel-size) + 2 * var(--wheel-border-size));
padding: 3px;
margin: auto;
background-color: var(--neutral-color);
border: solid var(--wheel-color) 10px;
border-radius: 50%;
user-select: none;
}
.wheel-container::before,
.wheel-container::after {
content: "";
display: block;
position: absolute;
height: 0;
width: 0;
top: 50%;
transform: translateY(-50%);
z-index: 2;
border: solid transparent 20px;
border-left-width: 0;
}
.wheel-container::before {
right: 0px;
border-right-color: var(--wheel-color);
}
.wheel-container::after {
right: -5px;
border-right-color: var(--neutral-color);
}
/* Roue */
.wheel {
display: block;
position: relative;
box-sizing: content-box;
margin: auto;
width: var(--wheel-size);
height: var(--wheel-size);
overflow: hidden;
border-radius: 50%;
border: solid var(--wheel-color) var(--wheel-border-size);
background-color: var(--wheel-color);
transition: transform var(--reset-duration);
transform: rotate(0deg);
cursor: pointer;
}
.wheel.spinning {
transition: transform var(--spinning-duration);
transform: rotate(calc(var(--nb-turn) * 360deg + (-360deg * var(--selected-item) / var(--nb-item, 1))));
}
.wheel::after {}
.wheel-item {
display: block;
position: absolute;
box-sizing: border-box;
/* position de l'item */
top: 50%;
left: 50%;
width: 50%;
transform-origin: center left;
transform: translateY(-50%) rotate(calc(var(--item-nb) * (360deg / var(--nb-item, 1))));
/* texte */
color: var(--neutral-color);
text-align: right;
padding: 0 50px 0 50px;
font-family: var(--wheel-font);
}
/* Background de l'élément = triangle rose plus clair */
.wheel-item:before {
content: " ";
display: block;
position: absolute;
box-sizing: border-box;
z-index: -1;
width: 0;
height: 0;
top: 50%;
left: 50%;
transform: translate(-47%, -50%);
padding-left: 0px;
--slice-max-width: calc(var(--PI) * var(--wheel-size) + var(--wheel-size) / 2);
--slice-width: calc((var(--slice-max-width) / var(--nb-item)) - var(--wheel-slice-spacing));
border: solid transparent calc(var(--slice-width) / 2);
border-left: solid transparent 0;
border-right: solid var(--neutral-color) calc(var(--wheel-size) / 2);
}
}
here is the the component code :
...
const wheelVars = {
'--nb-item': props.items.length,
'--selected-item': selectedItem,
}
const spinning = selectedItem !== null ? 'spinning' : '';
return( <div className="board-arisan-container">
<div className="wheel-container">
<div className={`wheel ${spinning}`} style={wheelVars} onClick={() => clearSelectedItem()}>
{props.items.map((item, index) => (
<div className="wheel-item" key={index} style={{
'--item-nb': index,
color: '#ffad00',
fontSize: 30,
fontWeight: 'bolder',
}}>
<span>{item}</span>
</div>
))}
</div>
</div>
</div>)
Thanks!

Bootstrap Tags input with Objects as tags typehead Free input not working

I am using bootstrap-tags input (Objects as tags - https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/) for my tags input.
It is working fine with Objects as tags for auto complete suggestions.
But I am trying to active Free input too. So, if tags not in the autosuggest list then it allow to add new tags.
Here is my code:
var tags = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('text'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
ttl: 1,
url:'[Json File Path]'
}
});
tags.initialize();
var elt = $('input#tags');
elt.tagsinput({
tagClass: 'badge badge-primary',
itemValue: function(item) {
return item.id;
},
itemText: 'text',
freeInput: true,
typeaheadjs: {
name: 'tags',
displayKey: 'text',
source: tags.ttAdapter()
}
});
Sample Json:
[{"id":15,"text":"money"},{"id":14,"text":"startup"},{"id":13,"text":"inspiration"},{"id":12,"text":"success"},{"id":11,"text":"challenge"}]
jS
var citynames = new Bloodhound({
datumTokenizer:
Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
url: 'https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/assets/citynames.json',
filter: function(list) {
return $.map(list, function(cityname) {
return { name: cityname }; });
}
}
});
citynames.initialize();
$('input').tagsinput({
typeaheadjs: {
name: 'citynames',
displayKey: 'name',
valueKey: 'name',
source: citynames.ttAdapter()
}
});
html
<div class="container">
<div class="col-12-xs">
<div class="">
<input type="text" value="Amsterdam,Washington" />
</div>
</div>
</div>
CSS
.icon-github {
background: no-repeat url('../img/github-16px.png');
width: 16px;
height: 16px;
}
.bootstrap-tagsinput {
width: 100%;
}
.accordion {
margin-bottom:-3px;
}
.accordion-group {
border: none;
}
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.twitter-typeahead .tt-hint
{
display: none;
}
.tt-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
font-size: 14px;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
cursor: pointer;
}
.tt-suggestion {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
color: #333333;
white-space: nowrap;
}
.tt-suggestion:hover,
.tt-suggestion:focus {
color: #ffffff;
text-decoration: none;
outline: 0;
background-color: #428bca;
}
Codepen
Codepen

Items on a circle

I'm trying to put hexagons made with CSS around a circle. I already got the circle and the hexagons (they are stocked on top of each other), I just can't get the code of organizing them to work (it's on the CSS part of the code). http://imgur.com/Sv82DB0 (I'm aiming this effect).
$darkPrimary: #ffa000;
$primaryYellow: #ffc107;
$lightPrimaryColor: #ffecb3;
$darkGray: #212121;
$redOrange: #ff5722;
$lightGray: #757575;
$dividerColor: #bdbdbd;
// $rot // rotation for the current item
$nb-items: 4;
$angle: (360deg / $nb-items); // angle between two items
// $nb-items // number of item
$rot: 0;
$circle-size: 21.875em;
#mixin placingElements () {
#for $i from 1 through $nb-items {
.shapes__circle:nth-child(#{$i}) {
// Rotate the axis
rotate: ($rot * 1);
// Move the item from the center
translate: $circle-size / 2;
// Rotate the item back to its default position
rotate: ($rot * -1);
}
$rot: $rot+$angle;
}
//Increments the '$rot' variable for the next item
}
.shapes {
position: absolute;
display: block;
margin-left: 30px;
&__circle {
#include placingElements();
position: relative;
top: 60px;
border: 19px solid $primaryYellow;
border-radius: 50%;
box-shadow: 0 0 1px 0 rgb(255, 255, 255);
width: 350px;
height: 350px;
z-index: 1;
}
&__hexagon {
width: 120px;
height: 80px;
background: $redOrange;
position: absolute;
top: -50px;
left: 90px;
margin: 10px auto;
z-index: 2;
&::before {
content: "";
width: 0;
height: 0;
position: absolute;
top: -45px;
left: 0;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
border-bottom: 45px solid $redOrange;
}
&::after {
content: "";
width: 0;
height: 0;
position: absolute;
bottom: -45px;
left: 0;
border-left: 60px solid transparent;
border-right: 60px solid transparent;
border-top: 45px solid $redOrange;
}
&--inside-img {
position: absolute;
height: 55px;
width: 55px;
left: 25%;
top: 32%;
}
&--inside-text {
position: absolute;
top: -14%;
left: 5%;
font-family: 'Overpass Mono', monospace;
font-size: 1rem;
color: $darkGray;
font-weight: 600;
}
}
}
<div class="shapes__circle">
<div class="shapes shapes__hexagon">
<p class="shapes__hexagon--inside-text">Ferramentas</p>
<img class="shapes__hexagon--inside-img" src="./assets/img/ferramentas.png" alt="">
</div>
<div class="shapes shapes__hexagon">
<p class="shapes__hexagon--inside-text">Ferramentas</p>
<img class="shapes__hexagon--inside-img" src="./assets/img/ferramentas.png" alt="">
</div>
<div class="shapes shapes__hexagon">
<p class="shapes__hexagon--inside-text">Ferramentas</p>
<img class="shapes__hexagon--inside-img" src="./assets/img/ferramentas.png" alt="">
</div>
<div class="shapes shapes__hexagon">
<p class="shapes__hexagon--inside-text">Ferramentas</p>
<img class="shapes__hexagon--inside-img" src="./assets/img/ferramentas.png" alt="">
</div>
</div>
<!-- __section-img--circle -->

Make form with css or canvas

I wonder if it is possible to create the image below, using css or canvas? It seems possible but do not have the ways to accomplish such a feat.
Grateful for the time spent.
Edit {SOLVED}
With the help of friend # apaul34208, could do as follows:
http://jsfiddle.net/Igaojsfiddle/CcDG7/
#hexagon {
width: 50px;
height: 55px;
background: red;
position: relative;
}
#hexagon:after {
content: "";
position: absolute;
bottom: -25px;
left: 0;
width: 0;
height: 0;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
border-top: 25px solid red;
}
Thank you all.
You can use canvas this way:
Demo
HTML
<canvas id="demo" width=90 height=120></canvas>
JavaScript
var ctx = demo.getContext('2d'), /// get canvas element
w = demo.width, /// cache dimensions
h = demo.height,
cw = w * 0.5; /// center hori.
ctx.beginPath(); /// start path
ctx.moveTo(0, 0); /// plot shape
ctx.lineTo(w, 0);
ctx.lineTo(w, h - cw * 0.8);
ctx.lineTo(cw, h);
ctx.lineTo(0, h - cw * 0.8);
ctx.closePath() /// closes and ends last line
ctx.fillStyle ='#f55641';
ctx.fill(); /// fill shape
#square {
width: 90px;
height: 85px;
background: #f55641;
}
#triangle {
width: 0;
height: 0;
border-top: 35px solid #f55641;
border-left: 45px solid transparent;
border-right: 45px solid transparent;
}
<div id="square"></div>
<div id="triangle"></div>

CSS background-size in IE8, background-size-polyfill not working

I am trying to use the background-size property in IE8 with this promising solution: https://github.com/louisremi/background-size-polyfill
But I am getting this error: SCRIPT65535: Unexpected call to method or property access.
Any ideas or alternatives to set the image size of a background-image in IE8?
It might be worth noting that the polyfill isn't designed to work with specific pixel sizes, i.e. background-size: 32px 64px
I know this doesn't answer your question, but for IE 8, I've just been removing non-important backgrounds with this CSS hack (instead of trying to figure out how to size them)
background: none\9;
try this css code, ie8 working dropshadow
body {
margin: 0;
background: url(images/algeria.jpg) center no-repeat;
-ms-behavior: url(backgroundsize.min.htc);
}
.bgsCover {
background-size: cover;
}
.bgsContain {
background-size: contain;
}
/* this allows to use a second background in all browsers and IE8 */
body:after {
content: "";
background: url(images/pattern.png) repeat;
position: absolute;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
/* responsive carousel FTW */
#carousel {
height: 45%;
width: 50%;
margin: 0 auto;
background: #0F0808;
border-radius: 3px;
}
#carousel ul {
height: 100%;
padding: 0;
margin: 0;
list-style: none;
}
#carousel li {
display: none;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
-ms-behavior: url(backgroundsize.min.htc);
}
#carousel .active {
display: block;
}
/* less interesting stuff below */
html, body {
height: 100%;
font-family: "Arial", "Liberation Sans", sans-serif;
color: #FEE;
}
h1 {
font-family: 'Great Vibes', sans-serif;
text-align: center;
margin: 0 0 40px;
text-shadow: 0 0 2px #222;
font-size: 1.7em;
font-weight: normal;
position: relative;
top: 20px;
filter: progid:DXImageTransform.Microsoft.Shadow(color=#222222, direction=90);
}
h1 i {
font-size: 1.3em;
display: block;
-moz-transform: rotate(-15deg);
-webkit-transform: rotate(-15deg);
-o-transform: rotate(-15deg);
-ms-transform: rotate(-15deg);
transform: rotate(-15deg);
filter: progid:DXImageTransform.Microsoft.Shadow(color=#222222, direction=90);
}
p {
text-align: center;
font-size: 1.5em;
text-shadow: 0 0 2px #222;
/* For IE 8 */
filter: progid:DXImageTransform.Microsoft.Shadow(color=#222222, direction=90);
/* For IE 5.5 - 7 */
zoom: 1;
color: #CCC
}
.button {
color: #0F0808;
text-decoration: none;
background: #FEE;
border-radius: 3px;
text-shadow: none;
padding: 4px 8px;
}
Your HTML Source code
<body class="bgsCover">
<h1><i>background-size</i> polyfill</h1>
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub">
<div id="carousel">
<ul>
<li id="img1" class="active" style="background-image: url(images/algerian1.jpg);">
<li id="img2" style="background-image: url(images/jar1.jpg);">
<li id="img3" style="background-image: url(images/algerian2.jpg);">
<li id="img4" style="background-image: url(images/jar2.jpg);">
</ul>
</div>
<p>Stretch background image using CSS3 <code>background-size: cover;</code> and <code>background-size: contain;</code>, in IE8 too.<br/>
Reacts to resize events for responsive backgrounds and galeries!</p>
<p><a class="button" href="https://github.com/louisremi/background-size-polyfill#readme">Instructions</a> - <a class="button" href="https://github.com/louisremi/background-size-polyfill/downloads">Downloads</a></p>
<script>
/*var images = [
'algeria.jpg',
'parthenon.jpg',
'propylaea.jpg'
],
curImg = 0;
document.getElementById("switchImage").onclick = function() {
curImg = ( curImg + 1 ) % images.length;
document.body.style.backgroundImage = "url(images/" + images[ curImg ] + ")";
};
var sizes = [
"Cover",
"Contain",
"Auto"
],
curSize = 0;
document.getElementById("switchSize").onclick = function() {
curSize = ( curSize + 1 ) % sizes.length;
document.body.className = "bgs" + sizes[ curSize ];
};*/
var items = document.querySelectorAll("#carousel li"),
curItem = 0;
setInterval(function() {
items[ curItem ].className = "";
curItem = ( curItem + 1 ) % items.length;
items[ curItem ].className = "active";
}, 3000);
</script>
</body>
i got the same issue on IE8. When i copied ".htaccess" in root folder. It works perfectly.
The Polyfill did not work for me either. My solution was to use the original "deprecated" version.
<!--[if lt IE 9]>
<script
src="//louisremi.github.io/jquery.backgroundSize.js/jquery.backgroundSize.js">
</script>
<script>
$('.logo').css( "background-size", "cover" );
</script>
<![endif]-->
Actually the deprecated version is not necesary.
For me it worked when I used behavior instead of -ms-behavior

Resources