Skip to main content

Forums

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 44 total)
  • Author
    Posts
  • in reply to: JQuery Set Anchor As Body Image #176122

    TheDutchCoder
    Participant

    That’ll work!

    I’m usually in favour of actually preloading images with AJAX, but this should be fine for a less-advanced approach ;-)

    in reply to: JQuery Set Anchor As Body Image #176094

    TheDutchCoder
    Participant

    Welcome!

    in reply to: Broken jQuery code, need help. #176085

    TheDutchCoder
    Participant

    My best guess is he wants to trigger tn1 and tn2 if they’re supplied, but if tn2 isn’t supplied he wants to trigger tn1 and tn3 instead.

    Now that’s perfectly fine, but you need a lot more to make this even remotely safe ;-)

    try this:

    $.fn.textnet = function(tn, tn1, tn2, tn3) {
      if (tn === 'toggleAttr') {
        if ((tn1 && tn1 !== 'undefined') && (tn2 && tn2 !== 'undefined')) {
          $(this).attr(tn1, tn2);
        } else if ((tn1 && tn1 !== 'undefined') && (tn3 && tn3 !== 'undefined')) {
          $(this).attr(tn1, tn3);
        } else {
          // None of the conditions are met.
          // E.g. tn2 and tn3 are missing.
        }
      }
    }
    

    Remember you HAVE to supply tn2, even if you only want to trigger tn3, like so: $('.something').textnet('toggleAttr', 'href', null, '#foobar');

    in reply to: [Solved] Can't get image to right-justify #176080

    TheDutchCoder
    Participant

    No worries! ;-)

    in reply to: [Solved] Can't get image to right-justify #176071

    TheDutchCoder
    Participant

    On line 133 of main.css you have #main td p and it’s set to float left.
    If you remove that, your facebook images will float to the right ;-)

    in reply to: Active State Navbar Sprite #176059

    TheDutchCoder
    Participant

    Yeah what Paulie_D said: you would need to specify which nav element is active, the easiest way of doing that is just give it an extra class (if you use static HTML), or use JavaScript to determine it.

    in reply to: Active State Navbar Sprite #176053

    TheDutchCoder
    Participant

    We would need a link to the site in order to see how you’ve written your HTML and CSS, or put it up on CodePen.

    in reply to: Vanilla JS or jQuery for click events? #176049

    TheDutchCoder
    Participant

    You can always make a custom jQuery build that only has methods you need.
    This would save space and time (since you don’t have to write it yourself).

    Although I agree that jQuery might be overkill in a lot of cases, never forget that:

    1. jQuery standardizes cross-browser differences (and since there are many, many browsers, this is really time-consuming).
    2. Since jQuery is so widely used, the chance that a user hits their cache is incredibly high (which means they don’t have to download it).

    I think jQuery is not that bad in most cases. I certainly use it in most of my projects, even though I normally only use it to do some very basic things, like toggling classes.

    in reply to: JQuery Set Anchor As Body Image #176048

    TheDutchCoder
    Participant

    Here you go!

    It’s not perfect (I’d personally would do some sort of pre-loading of the image) and you might want different styles, but it should do what you’re looking for!

    in reply to: Cache form? #176046

    TheDutchCoder
    Participant

    You can write a proxy php file that does the actual form validation and then just call it through an AJAX request with (e.g.) jQuery.

    It’s not that hard to do, it’s secure (because the actual validation is done in PHP) and it allows you to stay on the same page (awesome!).

    This might be a good start:
    http://blog.teamtreehouse.com/create-ajax-contact-form

    in reply to: [Solved] Colspan problem #176045

    TheDutchCoder
    Participant

    That’s a decent solution, just make sure the images are a fixed dimension, otherwise it will break the layout ;-)

    An easy way to do that:

    .product_float img {
      width: 90px;
      height: 90px;
    }
    
    in reply to: [Solved] Colspan problem #176040

    TheDutchCoder
    Participant

    Ah I get it, well I would suggest not floating .product_float then, because the only way to get a table to take up the remaining space is with width: 100%;, but that will push the table under the floating element.

    in reply to: Methods for showing and hiding element #176038

    TheDutchCoder
    Participant

    First off: this is actually a neat little plugin you’re working on ;-)

    Now, on topic:
    Maybe an easy way is to put the little menu inside the anchor, this will at least fix the issue for “regular” browsers, as you’ll still be hovering over the anchor while you’re hovering over the menu.

    Now, when it comes to other devices that use touch, it might be better to use jQuery and listen for ‘click’ events (I don’t think you have to listen to native touch events, afaik most (all?) mobile browsers send a click event as well).

    So a little mockup:

    It’s really rough and you’d probably want it to behave a little different, but what it does is: when you click the link (you can also hover it on desktop) it will show the menu, then when you click the link again, it will go to that link regardless.

    Again: you’d need to change the code here and there and do some decent testing, but it should get you on the right track (hopefully) ;-)

    in reply to: iFrame not working as expected #176030

    TheDutchCoder
    Participant

    Yeah that works ;-)
    Glad you found a solution!

    in reply to: [Solved] Colspan problem #176029

    TheDutchCoder
    Participant

    100% agree with that. Tabular data goes in tables ;-)

    You could, however, opt for a differently structured table, that’s fine (e.g. use <th></th> for the headings).

Viewing 15 posts - 1 through 15 (of 44 total)
icon-link icon-logo-star icon-search icon-star