Skip to main content

Forums

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

Forum Replies Created

Viewing 15 posts - 46 through 60 (of 67 total)
  • Author
    Posts
  • in reply to: Jquery Scroll Divs #165236
    Chromawoods
    Participant

    Check out this pen: http://codepen.io/chromawoods/pen/CKxkg

    The idea is to have a generic class (in my example “section”). And then in the JS, we animate to whatever index in that selection that comes next/previous.

    The gotoSection function takes that index integer and animates to it. This means that we could send whatever index we want. For example, maybe at the bottom of the page you want to animate back to the beginning again.

    Also added a handler for up/down arrows. I don’t have time to walk you through the whole demo now, but please feel free to shout is there is anything in that example that you don’t understand and I will do my best to explain. Good luck.

    Chromawoods
    Participant

    You should only have one version of jQuery included on the page. The one in the header is jQuery version 1.8.2 and the one in the bottom is version 1.9.1. Perhaps you can use the later version but put it in the header. If both plugins support the later version, then go for that.

    in reply to: Javascript thumbnail scroller like groveshark #164897
    Chromawoods
    Participant

    If you don’t mind using jQuery, have a look at Malsup Cycle 2. It’s very customizable and usually solves all my cycling demands.

    http://jquery.malsup.com/cycle2

    In your case, you probably want to have a look at this: http://jquery.malsup.com/cycle2/demo/carousel.php

    in reply to: Not able to calculate the height of the div. #164255
    Chromawoods
    Participant

    I could see this happening if your code runs before the carousel has fully initialized. The carousel might inject content into the page after your doc ready. It might explain why it works sometimes. But yeah, hard to say without seeing some code.

    in reply to: Cut string with jQuery #164123
    Chromawoods
    Participant

    @noahgelman: You need to escape the back-slash I think? filePath.split('\\')

    Anyway @Kuzyo, here’s a third solution to add to your arsenal of string-splitting:

    // Creates a substring containing whatever follows the last occurrence of '\'
    var fileName = filePath.substring(filePath.lastIndexOf('\\')+1);
    

    The above assumes that ‘filePath’ contains the string you want to filter.

    in reply to: Parsing urls with hash symbols #163471
    Chromawoods
    Participant

    @noahgelman lol. I was not criticizing his choice – I was just curious. No harm in that, I believe. I haven’t really come across this scenario before so that is why I asked.

    in reply to: Enter Button on Input #163328
    Chromawoods
    Participant
    var handleProfileName = function(val) {
    
      if(!val.match(/^[a-zA-Z0-9\-_]+$/)) {
        alert("Invalid name.  Names may contain alphanumeric characters, underscores, and hyphens");
        return;
      }
    
      alert("It is valid.");
    };
    
    
    $(document)
      .on('keydown', '#profile', function(event) { 
        if(event.keyCode === 13) {
          handleProfileName($(this).val());
        }
      })
      .on('click', '#btn-profile', function() { 
        handleProfileName($('#profile').val()); 
      });
    

    Something like that?

    in reply to: Parsing urls with hash symbols #163327
    Chromawoods
    Participant

    Why do you want to use hashes instead of query string params?

    Chromawoods
    Participant

    so looking back now at the functions php i included does it look right ? ( thanks for your help )

    That was not what I meant. The PHP looked fine. I meant the content INSIDE myscript.js. There was a tag inside that js-file, which is weird. And then the actual smoothdivscroll initialization was commented out.

    So I’m still wondering how/where you are initializing the plugin and because that plugin gave an error, I also wonder if you have changed any code in jquery.smoothdivscroll-1.3-min.js.

    And as I said, if you open the console you will see several other errors that you might want to get rid of to ensure that they are not interfering with what you are trying to do.

    Chromawoods
    Participant

    Looks like you’re trying to initialize it in myscript.js, right? But it looks weird.. There’s a script tag inside the script file… but it’s commented out? So nothing will happen.

    So maybe get rid of those script tags in myscript.js. :) Also, if you view the page with your console open, there are several JavaScript errors that you might want to take care of to make sure that it’s not conflicting with what you are trying to do.

    ..actually, the first error seems to come from the smoothdivscroll itself. Have you changed the plugin code in any way?

    in reply to: how to change default styling for select list #162579
    Chromawoods
    Participant

    I like the “Clickthrough” technique (no.5) described in the link that Paulie_D recommended. It allows full styling of the select (excluding options) and lets the native select options appear on click/touch, which is nice for touch devices.

    in reply to: can anyone expalin me the whats going on over here? #162575
    Chromawoods
    Participant

    Well you have instructed setTimeout to execute moveRed, right? And what does moveRed do? It sets a timeout, which is instructed to run moveRed, which sets a timeout, which is instructed to run moveRed, which… and so on until the end of days.

    You have created a recursive function. If you want it do happen only once with a delay, then you can’t have that timer inside the moveRed function. So.. replace moveRed(); with setTimeout(moveRed, 200); and remove the timer from the moveRed function.

    ..hope I understood you right. :)

    in reply to: Read more and less #160277
    Chromawoods
    Participant

    LOL! Best mental image ever.

    in reply to: Read more and less #160262
    Chromawoods
    Participant

    I forked your pen and made a jQuery function that you can apply. Note that the function takes a shouldExpand param, so you can also init wrappers initially expanded, if you want.

    http://codepen.io/chromawoods/pen/nHJDE

    in reply to: Drop Down Not Working – jQuery #158878
    Chromawoods
    Participant

    I see, $ is used by prototype too on your page. Well, you can still use $ as a jQuery alias if you pass it to your onready function, like this:

    jQuery(function($) {
        // You can now use $ as a reference to jQuery inside of this scope, hooray!
    });
    

    ..or you can make a straight up function expression:

    (function($) {
        // You can now use $ as a reference to jQuery inside of this scope, hooray!
    }(jQuery));
    
Viewing 15 posts - 46 through 60 (of 67 total)