我在容器中包含图像时遇到了一个小问题。当图像被拖到容器之外时,图像会隐藏我想要的图像,使图像不会隐藏在容器之外我想让图像停在容器上,我怎样才能使图像停留在脚本中。
$('img').on('click', function() {
$('#fotos').append('<div class="imgdrag"><img class="modal-content" src="' + $(this).attr('src') + '"/></div>');
$('.imgdrag').draggable();
$('#fotos').droppable();
$('.modal-content').resizable();
$(".download").attr("href", $(this).attr('src'));
$(".download").show();
});
});
&#13;
.container5 {
background-color: transparent;
width: 220px;
height: 320px;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
border: 1px solid red;
position: absolute;
overflow: hidden;
}
&#13;
<div id="fotos" class="bananas"><img class="modal-content" id="imgdisplay" /></div>
&#13;
$(".bananas").appendTo( $( ".container5" ) );
&#13;
答案 0 :(得分:1)
查看可拖动的jQuery UI小部件的containment option。
此处I baked a fiddle just for you.
<强> JS 强>
private HttpClient client = new HttpClient();
private List<Movie> movies;
public async Task<List<Movie>> LocalizaFilmesPorAtor(string ator)
{
if (string.IsNullOrWhiteSpace(ator))
{
return null;
}
else
{
var client = new HttpClient();
client.BaseAddress = new Uri("http://netflixroulette.net/");
HttpResponseMessage response = client.GetAsync("api/api.php?actor={0}", ator);
if(response.IsSuccessStatusCode)
{
var json = response.Content.ReadAsStringAsync().Result;
var _movies = JsonConvert.DeserializeObject<List<Movie>>(json);
movies = new List<Movie>(_movies);
}
else
{
movies = new List<Movie>();
}
return movies;
}
}