Having Issue on Creating Plugin with Multi Function
I am trying to create a custom plugin to update #result value from an option by a plugin functions at
This Demo
(function($) { $.fn.app = function(elem) { var elem = $.trim(elem.attr('id')); elem = "#" + elem; var elemTop = $(elem).offset().top; function underone() { } function undertwo() { } }(jQuery)); $("#mapper").app({ underone: function() { $("#result").html('Box is Under 1000 '); }, undertwo: function() { $("#result").html('Box is Under 2000 '); } });
but not sure how to handle the functions inside the plugin in a way that if box has been scroolled untill 1000 then apply 'Box is Under 1000 ' and when it is 2000 change to 'Box is Under 2000 '.
I mean I can apply many other JS or css rules based on the options.
Thanks