Forums >> Programming >> Proof of Concept (POC) >>
RE: New Message Display Method (Implementing jQuery UI)




Posted:
bvstone

RE: New Message Display Method (Implementing jQuery UI)

 
RE: New Message Display Method (Implementing jQuery UI)

We have made a few updates to this method now.  We decided that every time a message is clicked on it isn't always a good idea to show the "pop up" version of the message.  So, in this cases (so far) the full message will be shown instead of the pop up version:

  1. When you click on the title of a message (when viewing the message in a pop up)
  2. When you click the "in reply to" or "thread start" links when viewing a message

We will continue to look into other times this will be done and would love to hear when you feel the pop up version doesn't quite work as good.

How did we do this?  It was actually quite easy.

We first added an attribute to each of the hyperlinks we wanted to bypass the pop up view method as such:

<a href="/forum/display?threadid=/%threadid%/" data-id="showfull">

As you can see we added a data-id attribute of showfull.  (This really could have been anything, but we chose this value).

Next, in our Javascript we added an if statement around the pop up method as such:

function displayPostWindow() {
	$('body').on('click', 'a[href^="/forum/display"]', function(event) {
		
		if ($(this).attr('data-id') != 'showfull') {
			event.preventDefault();
	
            ...
			
		}
		
	})
}

Have we mentioned how much we love jQuery?  :)


Last edited 03/08/2016 at 10:08:12


Reply




Copyright 1983-2017 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).