jquery

how to Calculate whether an image is landscape or portrait

不打扰是莪最后的温柔 提交于 2021-02-17 19:30:08
问题 I am creating an image gallery with jquery. Is there any possibilities to Calculate whether an image is landscape or portrait using jquery? Thanks for your support. 回答1: You can simply compare width and height of the image. var someImg = $("#someId"); if (someImg.width() > someImg.height()){ //it's a landscape } else if (someImg.width() < someImg.height()){ //it's a portrait } else { //image width and height are equal, therefore it is square. } 回答2: This worked for me, using the natural

Ajax POST to controller action to update view model, and then reload div

百般思念 提交于 2021-02-17 17:09:32
问题 I'm still shaky with my use of ajax so there are a couple holes in my implementation here. I am trying to post to a controller action that will call a stored procedure to update my view model and then reload the div that will display the information. Ajax Post: $("#order-summary-panel").click(function(){ $.ajax({ url: '@Url.Action("GetOrderSummary", "Home")', type: 'POST', success: function() { alert("It Worked!") } }); }); Controller Action: [HttpPost] public ActionResult GetOrderSummary {

Ajax POST to controller action to update view model, and then reload div

吃可爱长大的小学妹 提交于 2021-02-17 17:08:31
问题 I'm still shaky with my use of ajax so there are a couple holes in my implementation here. I am trying to post to a controller action that will call a stored procedure to update my view model and then reload the div that will display the information. Ajax Post: $("#order-summary-panel").click(function(){ $.ajax({ url: '@Url.Action("GetOrderSummary", "Home")', type: 'POST', success: function() { alert("It Worked!") } }); }); Controller Action: [HttpPost] public ActionResult GetOrderSummary {

How to make text bold,italic and underline using jquery

ぐ巨炮叔叔 提交于 2021-02-17 15:22:27
问题 I have three checkboxes and a textbox now If I write something in textbox and check the bold checkbox the text should appear with bold effect and similarly italic and underline without postback(i.e it should reflect immediately with the selected effect). Here is my code: Bold:<input type="checkbox" value=""/> Italic:<input type="checkbox" value=""/> Underline:<input type="checkbox" value=""/> <input type="text" value=""> 回答1: You can do the following: <form> Bold:<input name="textStyle" type=

JqPlot add click event on data points

可紊 提交于 2021-02-17 15:16:17
问题 I am trying to use jqplot http://www.jqplot.com/tests/cursor-highlighter.php. I have successfully installed it in my framework. But i need to push a click event on the data points in the chart. This is my code so far, <script class="code" type="text/javascript"> $(document).ready(function () { var line1 = [['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84], ['26-Sep-08', 454.13], ['24-Oct-08', 379.75], ['21-Nov-08', 303], ['26-Dec-08', 308.56], ['23-Jan

JqPlot add click event on data points

放肆的年华 提交于 2021-02-17 15:15:31
问题 I am trying to use jqplot http://www.jqplot.com/tests/cursor-highlighter.php. I have successfully installed it in my framework. But i need to push a click event on the data points in the chart. This is my code so far, <script class="code" type="text/javascript"> $(document).ready(function () { var line1 = [['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84], ['26-Sep-08', 454.13], ['24-Oct-08', 379.75], ['21-Nov-08', 303], ['26-Dec-08', 308.56], ['23-Jan

JqPlot add click event on data points

瘦欲@ 提交于 2021-02-17 15:12:20
问题 I am trying to use jqplot http://www.jqplot.com/tests/cursor-highlighter.php. I have successfully installed it in my framework. But i need to push a click event on the data points in the chart. This is my code so far, <script class="code" type="text/javascript"> $(document).ready(function () { var line1 = [['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84], ['26-Sep-08', 454.13], ['24-Oct-08', 379.75], ['21-Nov-08', 303], ['26-Dec-08', 308.56], ['23-Jan

JqPlot add click event on data points

有些话、适合烂在心里 提交于 2021-02-17 15:11:21
问题 I am trying to use jqplot http://www.jqplot.com/tests/cursor-highlighter.php. I have successfully installed it in my framework. But i need to push a click event on the data points in the chart. This is my code so far, <script class="code" type="text/javascript"> $(document).ready(function () { var line1 = [['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84], ['26-Sep-08', 454.13], ['24-Oct-08', 379.75], ['21-Nov-08', 303], ['26-Dec-08', 308.56], ['23-Jan

图形的相对定位---绝对定位 ------ 固定定位

别等时光非礼了梦想. 提交于 2021-02-17 10:07:23
相对定位:占位置 <! DOCTYPE html > < html lang ="en" > < head > < meta charset ="UTF-8" > < title > Title </ title > < style > .box { width : 200px ; height : 200px ; background-color : red ; position : relative ; /* 相对定位占位置,后面的元素接着排列 */ top : 30px ; /* 在margin-top的位置基础上移动,这样就压盖了下面的图形 */ left : 40px ; /* 在margin-top的位置基础上移动,这样就压盖了下面的图形 */ margin-top : 30px ; /* 两个div一起向下移动30px */ } .box2 { width : 200px ; height : 200px ; background-color : green ; } </ style > </ head > < body style ="height: 2000px;" > < div class ="box" ></ div > < div class ="box2" ></ div > </ body > </ html > 绝对定位:不占位置,脱标了 <!

return bool from asp.net mvc actionresult

假如想象 提交于 2021-02-17 09:16:28
问题 I submitted a form via jquery, but I need the ActionResult to return true or false. this is the code which for the controller method: [HttpPost] public ActionResult SetSchedule(FormCollection collection) { try { // TODO: Add update logic here return true; //cannot convert bool to actionresult } catch { return false; //cannot convert bool to actionresult } } How would I design my JQuery call to pass that form data and also check if the return value is true or false. How do I edit the code