Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. (function($) {
  2. $.fn.createStickyObject = function() {
  3. var $alert_box = [];
  4. //var $selector = $(this.selector);
  5. //console.log("hotfix "+$this.selector);
  6. //var $selector = $this.selector;
  7. $(window).scroll(function() {
  8. if (!$alert_box.length) {
  9. $alert_box = $('#emall-alert-create form');
  10. }
  11. if ($alert_box.length){
  12. var scrollTop = $(window).scrollTop();
  13. // We must calculate the top always as the user
  14. // may deploy the prices box when there are multiple.
  15. var alert_box_offset_top = $alert_box.offset().top;
  16. if(scrollTop > alert_box_offset_top) {
  17. //$selector.removeClass('element-invisible');
  18. $(".emall-sticky-menu").removeClass('element-invisible');
  19. }
  20. else {
  21. //$selector.addClass('element-invisible');
  22. $(".emall-sticky-menu").addClass('element-invisible');
  23. }
  24. }
  25. });
  26. };
  27. Drupal.behaviors.sticky_menu = {
  28. attach : function(context, settings) {
  29. var $menu = $('div.emall-sticky-menu', context);
  30. $menu.createStickyObject({
  31. duration: 0,
  32. unstick: false,
  33. });
  34. }
  35. };
  36. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement