SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Croydon NSW Australia
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Disabling the Jquery function on a new added <a href>

    Hi all. I could use some help please.

    A landing page Im working on has jquery attached that provides the functionality of opening and closing of paragraphs of text 'panels' (i.e providing the viewing of hidden text), The link to open the hidden text is styled with text that reads "Show more" and an Arrow Icon.

    My problem is I want to flow in new content text for an update, and add a independent link to a Youtube clip. Everytime I add an <a href> in my code, my new link is styled to the "Show more" with an Arrow Icon style.

    How Can I override this please?

    Any suggestions appreciated.

    Im hoping I can override this with some inline CSS/JS? Thankyou,

    David

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,055
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    It sounds like you have attached this behaviour (opening and closing of paragraphs) to every link on your page.
    The best way is to use a css class to limit it those links that actually do open and close things.

    You probably have:

    Code:
     $("a").on("click", function ...)
    you need:

    Code:
     $("a.open-close").on("click", function ...)
    Then you need to add a class to those links that open and close things:

    Code:
    <a href="..." class="open-close" >Open</a>
    If that doesn't work, can you post your code.

  3. #3
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Croydon NSW Australia
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks for that, Ill have a look and see if I can find the offending code in the JS.

    Quote Originally Posted by Pullo View Post
    Hi,

    It sounds like you have attached this behaviour (opening and closing of paragraphs) to every link on your page.
    The best way is to use a css class to limit it those links that actually do open and close things.

    You probably have:

    Code:
     $("a").on("click", function ...)
    you need:

    Code:
     $("a.open-close").on("click", function ...)
    Then you need to add a class to those links that open and close things:

    Code:
    <a href="..." class="open-close" >Open</a>
    If that doesn't work, can you post your code.
    Thanks for that, Ill have a look and see if I can find the offending code in the JS.
    Last edited by Pullo; Feb 20, 2014 at 01:25. Reason: Removed OP's reply from within quote block

  4. #4
    SitePoint Member
    Join Date
    Sep 2012
    Location
    Croydon NSW Australia
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    The offending issue was an unclosed DIV </div> on a previous "Read More" resulting in the style flowig into the paragraph below, and thus styling the next <a href>


    Thanks for your help!


    David

  5. #5
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,055
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Glad to hear that you got your problem sorted.
    Thanks for taking the time to let us know


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •