saasbook

movie_popup_json.js

Mar 13th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. var MoviePopupJson = {
  2. // 'setup' function omitted for brevity
  3. getMovieInfo: function() {
  4. $.ajax({type: 'GET',
  5. dataType: 'json',
  6. url: $(this).attr('href'),
  7. success: MoviePopup.showMovieInfo
  8. // 'timeout' and 'error' functions omitted for brevity
  9. });
  10. return(false);
  11. }
  12. ,showMovieInfo: function(jsonData, requestStatus, xhrObject) {
  13. // center a floater 1/2 as wide and 1/4 as tall as screen
  14. var oneFourth = Math.ceil($(window).width() / 4);
  15. $('#movieInfo').
  16. css({'left': oneFourth, 'width': 2*oneFourth, 'top': 250}).
  17. append($('<p>' + jsonData.description + '</p>'),
  18. $('<a id="closeLink" href="#"></a>')).
  19. show();
  20. // make the Close link in the hidden element work
  21. $('#closeLink').click(MoviePopup.hideMovieInfo);
  22. return(false); // prevent default link action
  23. }
  24. // hideMovieInfo omitted for brevity
  25. };
Add Comment
Please, Sign In to add comment