Mar 12

some browsers are currently supporting the CSS text-shadow property, although the others are slowly coming around. even though this property is technically part of the CSS level 3 library, more and more people are using it (and even more abusing it) everyday. here’s something that i find interesting that doesn’t abuse the property, but can add more life to your page.

we’re going to use jQuery to add a the ability to make your elements glow on mouseover. any browser that doesn’t fully support the text-shadow property will still show the glow, but you won’t be able to add the “halo” effect.

so let’s get down to brass tacks shall we? all of the .js files you can download here in a nice .rar file. there are a total of of three files you’ll need to call to make this bad boy work.

basic example

$(document).ready(function() {
$('.glow-me').addGlow();
});

advanced example

$(document).ready(function() {
$('.glow-me').addGlow({
radius: 20,
textColor: '#ff0',
haloColor: '#ffa',
duration: 200
});
});

you’ll want to customize your options in the jquery-glowing.js file. here’s the basic rundown:

  • textColor: color the text should glow.
  • haloColor: halo color (for browsers that support it).
  • radius: controls the halo size (for browsers that support it).
  • duration: speed of the glowing effect.

    Online demo is right here.

  • Mar 9

    this script is pretty straight forward. some people may have uses for it, others may not. i created this for a specific request and i’m still making improvements to it.

    so here it is. a news scroll for your site! w00t! this is straight up JavaScript, so no plug-in’s or anything like that needed. works in IE 5+ and FF 1+. it’s very simple to insert into your site. view the demo HERE. you can modify the look and feel all you want. more <3 for CSS. let us get started shall we?

    here be the JavaScript!!!


    //newsticker.js
    TICKER_CONTENT = document.getElementById("TICKER").innerHTML;

    TICKER_RIGHTTOLEFT = false;
    TICKER_SPEED = 2;
    TICKER_STYLE = "font-family:Arial; font-size:12px; color:#FFFFFF";
    TICKER_PAUSED = false;

    ticker_start();

    function ticker_start() {
    var tickerSupported = false;
    TICKER_WIDTH = document.getElementById("TICKER").style.width;
    var img = "";

    // Firefox
    if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1) {
    document.getElementById("TICKER").innerHTML = "

    "+img+" "+img+"

    ";
    tickerSupported = true;
    }
    // IE
    if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1) {
    document.getElementById("TICKER").innerHTML = "

    "+img+""+img+"

    ";
    tickerSupported = true;
    }
    if(!tickerSupported) document.getElementById("TICKER").outerHTML = ""; else {
    document.getElementById("TICKER").scrollLeft = TICKER_RIGHTTOLEFT ? document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth : 0;
    document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT;
    document.getElementById("TICKER").style.display="block";
    TICKER_tick();
    }
    }

    function TICKER_tick() {
    if(!TICKER_PAUSED) document.getElementById("TICKER").scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1);
    if(TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft < = 0) document.getElementById("TICKER").scrollLeft = document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth;
    if(!TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft >= document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth) document.getElementById("TICKER").scrollLeft = 0;
    window.setTimeout("TICKER_tick()", 30);
    }

    to call the ticker to your page, the .JS DOES NOT go in the HEAD section of your document. it trails right below the actual content in the body.

    EXAMPLE:

    <div id="ticker" style="overflow:hidden; width:520px" onmouseover="TICKER_PAUSED=true" onmouseout="TICKER_PAUSED=false">
    This is news. As is this. And This. This is what will display in the actual ticker. And this as well. DO NOT USE <br /&gt tags as it will cause all kinds of crazy, unless that's what you're looking for. Feel free to add any HTML markup to seperate your "news" or what not.
    </div>
    <script type="text/javascript" src="newsticker.js" language="javascript"></script>

    make sure that the JS is being called correctly (absolute path would be nice). in this example, i have it set to pause when someone mouses over a headline, and un-pause on mouseout. now let us edit some variable in the actual .JS to make it more “yours”.

    TICKER_RIGHTTOLEFT

  • pretty self-explanatory. do you want it scrolling left to right or right to left?

    TICKER_SPEED

  • set the speed of the scroll. 1 = slowest, 10 = fastest

    TICKER_STYLE

  • set your styles here. font-family, color, all the fun stuff.

    TICKER_PAUSED

  • when this variable is set to true, the scrolling ticker is paused. this value can be changed at runtime, for example when the mouse is over the ticker.

    what i really use this for is to announce site news, via an RSS or XML feed. this is really easy to set-up.

    instead of hard-coded text, we’re going to use a php include (you can use whatever suits your purpose). so in-between the DIV tags i put this:

    < ? include "newsfeed.php" ?> //you can call this whatever you want

    that file is just a php file that parses the data from an RSS or XML feed and converts it into plain HTML, thus letting the ticker read the new info. i find this to work the best, but that’s just me.

    i’m not going into how to do this at this time, if you’re really lost, feel free to comment. the best solution would be using something like MagpieRSS to help you with your parsing needs.

    and with that, i’m going to go cry in my beer now.

    until next time….

  • Mar 4

    i’ve been out trying to get a regular office job again. i like the freedom of freelancing, but i miss working in a team environment. i like bouncing ideas off of other people i guess. i just don’t get this with freelancing.

    i’ve been out on a couple of interviews and so far i’ve been shot down in every single one. i think a lot of this has to do with how i come off in interviews. I spent 8 years at the same company so i haven’t really been “out there” in quite a while. it’s bad when it’s a head-to-head interview, but put me in a panel interview and i just loose it. i’m overwhelmed. totally out of my element. scared. yes scared. i feel like i’m on an operating table and having an autopsy performed on me while i’m still wide awake.

    i wish someone would take a chance on me. give me a trial run. let me get in and show you what i can do.

    yes, this is a “woe is me” post, but i don’t know where else to get it off my chest.

    i WANT to work. i NEED to work.

    just praying someone will give me the chance to prove myself.

    in closing, tomorrow i’ll have a new post (more AJAX and maybe some straight up JavaScript) or two that won’t be full of self-loathing. i promise.