The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Named $(window) selector wont trigger functions

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #167104

    Once i named $(window) to $(window.named) The functions within wont trigger on resize. I’m not entirely sure why. Can anyone explain?

    $(window.named).resize(function() {

    What is window.named?

    It would be helpful if you provided a live example (e.g., on codepen) and described:

    • what you want to accomplish
    • how you tried to do it
    • what you expected to happen
    • what actually happened

    My goal is to unbind the resize event for a specific $(window).resize and not the other ones.
    if the if statement is true, i want to unbind the window resize but in order to unbind that one specifically i need to name it, so for example $(window.thisOne).resize() will unbind and the functions within will not trigger only if the if statement is true. But and the if statement is false, the resize() event will not be unbinded and the functions within should be triggered. The problem is not the if statement because i removed it entirely and the functions within $(window.thisOne).resize() should be triggered but they arent once i named it. When i remove thisOne it works fine.

    $(window.thisOne).resize(function() {
     if ( $("link").attr("href") == "css/stylesheet-1.css" ) {
            hideBar(); // Hide the sidebar initially 

    Do the origin and protocols of your main and child windows match?


    Let me restate my question because it all comes down to a simple goal.

    How can i disable a specific $(window).resize() function and not the others?

    if i do this

    it unbinds all of the $(window).resize.

    I would only want to unbind a specific $(window).resize() function and not others that contain different code within.


    Nevermind. I got it working.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.