1

I essentially only understand how to read bits of JavaScript and make modifications.

I am using grid-slider, a script I purchased, but the code writer is mia at the moment, so hopefully someone here can help me.

Basically, it's a slider and there are options to have links open like normal or to have links open in a panel on the same page. I want some links to open in a panel and others to open in the parent window.

It seems to me that all that would be required to do this would be to activate the panel display function (which I've done) and then set up an exclude function to exclude certain uls or lis with a specific class from the function. I've read about the .not selector, but I don't see how to make it applicable to this code:

else {
    if (this._displayOverlay) {
        if ($item.find(">.content").size() > 0) {
            $item.data("type", "static");
        }
        else {
            var contentType = this.getContentType($link);
            var url = $link.attr("href");
            $item.data({type:contentType, url:(typeof url != "undefined") ?  url : ""});
        }
        $item.css("cursor", "pointer").bind("click", {elem:this, i:i}, this.openOverlay);
    }
    $link.data("text", $item.find(">div:first").html());
    $img = $link.find(">img");                      
}

Can anyone help based on looking at this? There is a link to the demo of the code in here.

Thank you.

Milad Rashidi
  • 1,296
  • 4
  • 22
  • 40
  • Can you show the whole function, and the way you're calling the function. Also, it'd help to know what classes to which you want to apply the function, and which you don't. – David Thomas Jul 02 '12 at 21:15
  • It's not really clear what you need to do. Can you explain better? Which classes you need to exclude? – Carlo Jul 02 '12 at 21:17
  • apply not where you want exclude class to event, for example .not('.myexcludedclass').bind(... but is not clear what you want – Alex Ball Jul 02 '12 at 21:22
  • Alex Ball, Thank YOU! I was trying not to post too much code, but I realize the way I'm describing it was a bit novice like and was just hoping for the best and the answer you gave me worked perfectly! I just didn't know where to put the .not to make it effective. For anyone who returns with a similar question, I just made up an id called test and wanted to make any li attributes in the above link's html code open as a regular link instead of in a panel. This code provided by Alex worked perfectly: $item.css("cursor", "pointer").not("#test").bind("click", {elem:this, i:i}, this.openOverlay); – user1497158 Jul 02 '12 at 21:33
  • @AlexBall You should add your comment as an answer so it can be marked as the solution :) – Mottie Jul 03 '12 at 02:30
  • @fudgey added as answer. Thanks. I'm Happy to be useful. – Alex Ball Jul 03 '12 at 07:44

1 Answers1

1

Referring to the jQuery documentation .not() method constructs a new jQuery object from a subset of the matching elements. So you can apply .not() where you want exclude, in this case your class, to an event, for example exclude a class to bind('click'):

$item.css("cursor", "pointer").not('.myexcludedcalss').bind("click", {elem:this, i:i}, this.openOverlay);

(like mentioned in the comment above)

Alex Ball
  • 4,404
  • 2
  • 17
  • 23