Программно перерисовать курсор
Добрый вечер.
Ситуация такая, под курсором динамически появляется объект, у которого cursor:pointer, к примеру, однако, пока мышь не двинешь, курсор остается от предыдущего объекта. Подскажите, пожалуйста, имеется ли возможность программно перерисовать курсор средствами JS? Спасибо. |
Конкретной функции нет, так что мучайтесь-извращайтесь. Самое весёлое(кроссбраузерность) ещё впереди.)
|
<head>
<style>
DIV {
position: absolute;
height: 100px;
width: 200px;
}
</style>
</head>
<body>
<div id="elem" style="background: #ff0;"> </div>
<script>
document.getElementById('elem').onclick = function(){
var newDiv = document.createElement('div');
newDiv.style.background = '#f00';
newDiv.style.cursor = 'pointer';
newDiv.innerHTML = ' ';
document.body.appendChild(newDiv);
*!*this.style.cursor = 'pointer';*/!*
};
</script>
</body>
|
Я имею в виду такую ситуацию:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#done').click( function () {
$("#done").animate({marginLeft:"-200px"}, 300, function() {
})
;return false;
});
});
</script>
<style>
#done, #dtwo, #wrapper{width:200px; height:200px; overflow:hidden; float:left;}
#slider{width:400px; height:200px;}
#done{background:#600;cursor:pointer;}
#dtwo{background:#006;cursor:default;}
</style>
</head>
<body>
<div id="wrapper">
<div id="slider">
<div id="done"></div>
<div id="dtwo"></div>
</div>
</div>
</body>
</html>
|
Ну сделай либо так:
$("#done").css({cursor: 'default'}).animate({marginLeft:"-200px"}, 300);
либо так:
$("#done").animate({marginLeft:"-200px"}, 300, function() {
this.style.cursor = 'default';
});
|
Цитата:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('form').submit( function () {
$("#done").css({cursor: 'default'}).animate({marginLeft:"-200px"}, 300);
;return false;
});
});
</script>
<style>
#done, #dtwo, #wrapper{width:200px; height:200px; overflow:hidden; float:left;}
#slider{width:400px; height:200px;}
#done{background:#600;cursor:pointer;}
#dtwo{background:#006;cursor:default;}
</style>
</head>
<body>
<div id="wrapper">
<div id="slider">
<div id="done">
<form name="frm">
<input name="inp" type="text" />
</form>
</div>
<div id="dtwo"></div>
</div>
</div>
</body>
</html>
|
| Часовой пояс GMT +3, время: 08:59. |