Hi all,
I have the Engage: Tell A Friend module installed on a page that also has the NavSharp module installed on it. As long as I don't have a style selected in NavSharp (which doesn't then show any menu entries since it is the style that transforms the xml and then styles it) the modal popup function of the TAF module works.
As soon as I select a style in NavSharp, the modal popup no longer works. I know that both modules utilize jQuery for functionality. When I view the Error Console in Firefox (the browser I normally use) I receive the following error:
Error: $(this).closest is not a function
Source File: /WebResource.axd?d=WVlXdh6q4oijJkWLqRekKaylkFyfXltUvFAW0iDCbTP8EuMn5ycRU9Zx2DiCSEcfsNT6FHveNo8pFR5pFkVcI3SH13cUGVpG0&t=634036648670891250
Line: 64
I know that .closest() is a jQuery method and it should be present. We are using DNN 5.1.4 on the site and I have it configured to use the hosted version of jQuery so it is using jQuery 1.4.2. I have tried modifying the javascript in the NavSharp style so that it doesn't use $ as the default object hoping that would fix the issue - but it doesn't. I include the modified javascript from the NavSharp style (I replaced every instance of $ by itself with $j):
var $j = jQuery.noConflict();
(function($j) {
$j(function() {
$j("ul.tree-vista").each(function() {
var tree = $j(this);
tree.children("li:first")
.children("table")
.find("div.max-min")
.addClass("top-first-max")
.click(function() {
$j(this).toggleClass("top-first-max")
.toggleClass("top-first-min");
});
tree.parent()
.find("ul")
.each(function() {
var $sub = $j(this);
$sub.children("li:last")
.children("div.sub")
.addClass("no-i")
.end()
.children("table")
.find("div.left-space")
.addClass("last-space")
.end()
.find("div.max-min")
.addClass("last-max")
.click(function() {
$j(this).toggleClass("last-max");
});
});
// tree.find("li")
// .each(function() {
// var li = $j(this);
// var sub = li.children("div.sub");
// var action = li.children("table").find("div.max-min");
// var folder = li.children("table").find("div.folder");
// action.click(function() {
// action.toggleClass("min");
// folder.toggleClass("open");
// sub.slideToggle();
// });
// //li.find("a").each(function(){
// //if((this.pathname.indexOf("/")==0?this.pathname:"/" + this.pathname).replace("default.aspx","")==location.pathname.replace("default.aspx","")){
// // action.trigger('click');
// // $j(this).addClass("current");
// //}
// //});
// });
//lijoin add for hit
tree.find("li").each(function() {
var li = $j(this);
$j(this).find(">table div.max-min .hit").click(function() {
$j(this).toggleClass("hit-active");
$j(">div.sub",li).slideToggle();
});
});
});
});
})(jQuery);
I'm not sure if this is the correct way of doing this. With this change made the modal popup still doesn't work. Can you suggest something that will allow the TAF module to co-exist with the NavSharp module as we really like the TAF module and want to use it on the site.
Thanks.
Raymond Weiler
Technical Support
Commerce Technology International