Guest User

Untitled

a guest
Sep 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. jquery animation for OnBegin and Success is interrupted and not smooth at all anymore
  2. function OnBeginStuff() {
  3. $("#StuffPanel").fadeTo("slow", 0.50);
  4. }
  5. function OnCompleteStuff() {
  6. $("#StuffPanel").fadeTo("slow", 1.00);
  7. }
  8.  
  9. $(document).ready(function () {
  10.  
  11. $('.mainLink', $('#NavigationPanel')).click(function (e) {
  12. e.preventDefault();
  13. $.ajax({
  14. url: $(this).attr('href'),
  15. beforeSend: OnBeginStuff,
  16. complete: OnCompleteStuff,
  17. success: function (html) {
  18. $('#StuffPanel').html(html);
  19. }
  20. });
  21. });
  22. });
  23. </script>
  24. </head>
  25. <body>
  26. <div id="NavigationPanel">
  27. @Html.ActionLink("1", "Index", "One", null, new { @class = "mainLink" })
  28. @Html.ActionLink("2", "Index", "Two", null, new { @class = "mainLink" })
  29. @Html.ActionLink("3", "Index", "Three", null, new { @class = "mainLink" })
  30. </div>
  31. <div id="StuffPanel">
  32. @RenderBody()
  33. </div>
  34. </body>
  35. </html>
  36.  
  37. $('.mainLink').click(function (e) {
  38. e.preventDefault();
  39. $.ajax({
  40. url: $(this).attr('href'),
  41. beforeSend: OnBeginStuff,
  42. complete: OnCompleteStuff,
  43. success: function (html) {
  44. $('#StuffPanel').html(html);
  45. }
  46. });
  47. });
Add Comment
Please, Sign In to add comment