I know one can set plugin options, after things are set. But I'm not quite sure how to do it. So I created a simple jquery UI example, using the draggable(), with zIndex option already set. So, if I click the link I created, I want to change the zIndex option to another integer. Here's the link I am work from: http://jqueryui.com/demos/draggable/#option-zIndex
<script>
$(开发者_JS百科function() {
$( ".dragimgs" ).draggable({ zIndex: 2700 });
});
</script>
<img class="dragimgs" src="someimg.png" />
<a id="clickme">Click To Change zIndex</a>
So the question is how do I reset the zIndex (or any available option), dynamically. I am assuming that a js function or some onclick event can be utilized, but I honestly don't know how.
You can use .draggable( "option" , "optionName" , value )
to change your zIndex
Putting that together with the zIndex it would look like the following...
$("#clickme").click(function() {
$(".dragimgs").draggable("option", "zIndex", 1000);
});
Example on jsfiddle
精彩评论