悬停上的nivo滑块显示prev和下一个按钮(nivo slider on hover show prev and next buttons)
请有人帮我这个。 有没有办法显示Nivo Slider。 和上一个。 仅当鼠标悬停在幻灯片上时按钮?
Could anyone help me on this please. Is there a way to show Nivo Slider next. and prev. buttons only when the mouse is over the slides?
原文:https://stackoverflow.com/questions/15005390
更新时间:2021-07-07 11:07
最满意答案
更新您的Controller代码:
using System.Web.Script.Serialization; [HttpGet] public JsonResult Get(int id) { var ListOfMyObject = db.TESTS.ToList(); JavaScriptSerializer jss = new JavaScriptSerializer(); string output = jss.Serialize(ListOfMyObject); return Json(output , JsonRequestBehavior.AllowGet); }
从这里读起来。 为什么需要JsonRequestBehavior?
Alhamdulillah, this is solved.
needed to enable CORS on web service.
Steps. 1. Install Microsoft ASP.NET Web API 2.2... 5.2.3 from Nuget Packages 2. Add
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
in WebApiConfigMy Json Code in html is:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Get Json value from WebAPI url</title> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <script type="text/javascript"> var getJSON = function (url) { return new Promise(function (resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open('get', url, true); xhr.responseType = 'json'; xhr.onload = function () { var status = xhr.status; if (status == 200) { resolve(xhr.response); } else { reject(status); } }; xhr.send(); }); }; getJSON('http://192.168.5.154/mobileapi/api/values/2').then(function (data) { //alert('Your Json result is: ' + data.result); //you can comment this, i used it to debug //alert(data.TEXT); result.innerText ="Oracle Data\nId: " + data.ID + "\nText: "+ data.TEXT; //display the result in an HTML element }, function (status) { //error detection.... alert('Something went wrong.'); }); </script> <div id="result" style="color:red"></div> </body> </html>
My web service code is:
public IHttpActionResult Get(int id) { var product = db.TESTS.FirstOrDefault((p) => p.ID == id); if (product == null) { return NotFound(); } return Ok(product); }
相关问答
更多-
您可以使用您想要返回的错误轻松构建匿名类型。 if (string.IsNullOrEmpty(ROOM)) { return this.Request.CreateResponse( HttpStatusCode.BadRequest, new { error= "ROOM cannot be empty or NULL" }); resp.Content.Headers.ContentType = new M ...
-
简单的API调用来解析JSON(Simple API call to parse JSON)[2022-01-05]
你得到的回应不是哈希。 它是一组哈希值。 请尝试打印出responsebody [0]。 responsebody = [{}, {}] 我想你的响应主体就像上面的代码一样。 调用reponsebody [0]将取出数组中的第一个元素(即您需要的响应哈希)。 The response you get is not a hash. It is an array of hashes. Please try printing out responsebody[0]. responsebody = [{}, {} ... -
Call.execute()方法返回一个Response对象,该对象具有用于查找状态码的code()方法和用于查找代码是否在[200,300]范围内的isSuccessful()方法,这通常表示成功。 通常查看你正在使用的库的文档是很有帮助的。 这是okhttp的文档 Can read this error: Response response=okHttpClient.newCall(request).execute(); if (response.code() != 200) { errorMess ...
-
更新您的Controller代码: using System.Web.Script.Serialization; [HttpGet] public JsonResult Get(int id) { var ListOfMyObject = db.TESTS.ToList(); JavaScriptSerializer jss = new JavaScriptSerializer(); ...
-
您在结尾TSID标记中缺少“ / ”。
16 应该 16 这应该会从API获得正确的响应。 You're missing a "/" in the ending TSID tag.16 Should be 16 That should get you the right response from API. -
这是因为您的反序列化失败了。 您尝试在服务器端反序列化的内容与您的json模型不匹配。 目前您尝试反序列化具有属性名称保留的对象列表(这是具有预期属性的对象)。 要修复,请按照以下方式重新构建您的json。 var model = [ { "ticketId": "782274b8-10d9-444c-8f05-3117853e3ee0", "clubId": 70656, "courtNumb ...
-
您不需要自己进行反序列化,请按如下方式进行更改: public async Task
Get([FromBody] CodeDTO.RootObject bCode) { string Bar_Code = bCode.Barcode.ToString(); } 当您发布数据时,请在您的标题请求中指定内容类型: contentType:"application/json" You don't need to do the deserializati ... -
问题是CORS - 跨源资源共享。 换句话说,呼叫来自不同的域,为此我需要启用CORS。 The problem was CORS - Cross origin resource sharing. In other words, the call was from a different domain and for that to work I need to enable CORS.
-
它很可能显示“tweet is duplicate”,因为您的测试代码每次都以相同的状态更新。 尝试更新以执行以下操作: JSON.parse(token.request(:post, "https://api.twitter.com/1.1/statuses/update.json?status=a2a2sssssscurrss%20bip%20#{rand.to_s}&display_coordinates=false").body) 至少这会在你的状态结束时给你一个随机字符串,Twitter希望忽 ...
-
嗨,我找到了这个问题的解决方案,我想与您分享。 问题是我是如何用错误的JSON格式构建JSON的。 结果,使用JObject和Jtoken的解析不起作用。 但是使用格式良好的JSON,解析可以使用标准示例uisng JObject和JToken 这篇文章详细介绍了如何使用JSON.stringify创建正确发送Web API 问题的 JSON,为我的Json对象 添加一个额外的\和“”JSON.stringify问题 为我的Json对象 添加了一个额外的\和“” 格式良好的Json将是这样的: { ...