Jump to content

GregL83

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Everything posted by GregL83

  1. I'm trying to access 'this' from a jquery plugin method that has been called as a result of an event. 'this' becomes the element/object that fired the event instead of the original 'this' object that the plugin was applied on. The reason is because my init function stores data using the jquery.data() method and I want to nicely retrieve some of that data from inside the event method as a standard OOP language would allow. (function( $ ){ var methods = { init : function( options ) { return this.each(function(){ $("#example").bind('click.name', methods.doSomething); }); }, destroy : function( ) { return this.each(function(){ $(window).unbind('.tooltip'); }) }, doSomething : function( ) { // I WANT TO ACCESS 'THIS' HERE HOWEVER, 'THIS' NOW REFERS TO THE ELEMENT/OBJECT FROM THE ONCLICK EVENT (#example) // BEFORE THIS WOULD REFERENCE THE ENTIRE OBJECT WHERE THE .data() FUNCTION COULD BE USED // ITS MY UNDERSTANDING YOU CAN DO THIS WITHOUT PASSING THE OBJECT... HOW??? // THANKS }, }; $.fn.tooltip = function( method ) { if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on jQuery.tooltip' ); } }; })( jQuery ); Thanks in advance!
  2. lastkarrde, I was thinking along the same lines of what you've suggested. I think its a great start and would work. BUT i'm wondering if anyone has already done something similar, because sometimes you can't always see problems or efficiency issues until the system is already coded. I'll do some more research and see what solutions i can come up with. Otherwise, if anyone has done any kind of algorithms for ad relevance, your advice would be greatly appreciated.
  3. BUMP... No ideas? Anyone want to take a stab???
  4. I was pondering the idea of collecting the browsing history of users on my site. Which articles they read. What they search for. Where they have come from. I wanted to start displaying relevant articles on my index page or suggested articles based on their browsing history. I really have no solid idea on how to implement this tech. The main concept would be: 1) Collect data about the user 2) Use user data to relate to relevant content 3) Display relevant content to the user when they login Have any of you done this for an ad firm?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.