I am trying to extend DOMWindow example 6 to anchor to various elements at the page. As it is, the syntax implies that selector needs to be static, be it class name or id, both work. What I'd like to do, however, is assign the id of the clicked element as a selector, but it doesn't seem to work. A simple example:
$(function() {
$('.example6DOMWindow').openDOMWindow({
height: 100,
width: 300,
positionType: 'anchored',
anchoredClassName: 'exampleWindow6',
anchoredSelector: '#someid',
eventType: 'click',
windowSource: 'ajax',
windowHTTPType: 'post'
});
});
I tried to specify selector as anchoredSelector: '#' + $(this).attr('id')
, but .openDOMWindow cannot be used in the same way as .click(), so $(this) does not actually refer to the clicked element. I also tried the following, but it didn't work either:
$(function() {
$('.example6DOMWindow').click(function() {
var link = $(this);
link.openDOMWindow({
height: 100,
width: 300,
positionType: 'anchored',
anchoredClassName: 'exampleWindow6',
anchoredSelector: '#' + link.attr('id'),
eventType: 'click',
windowSource: 'ajax',
windowHTTPType: 'post'
});
});
});
Does anyone have suggestions for how this could be achieved? Or maybe alternative plug-ins that can achieve the same functionality?