I recently had several uses for this function, and there are probably many out. I am not proclaiming this unique nor the best available, but it works which is what counts. I actually took the majority of it from someone else, I think from php.net, but I tweaked it a little bit.
Pass in the string, and optionally, the length you want to curb it to. You can set a default in the highlighted section of the code (currently set at 100). Right now it returns it with a “…” at the end, which is what I wanted. Go ahead and remove the second highlighted section of the code if you don’t want this. (The highlights are very small – look hard! Squint if you must.)-Kerry
Ok, I know I have a bunch of bugs to report as well but this what I’ve been working on, so I thought I would share it with you.
Many sites use flash tor fading images into each other, or to present a slide show. Sure, you can do this if you have the flash experience, or have one of the many programs that create them for you (most are paid programs, unless you want a watermark.) It’s not a bad solution, but there is another solution, Javascript.
A friend of mine found this cross-fade script, Image Cross Fade Redux. That shows it in action (I suggest taking a look so you can see what the cross fader does), he unfortunately doesn’t offer you the code. It’s not hidden, but he doesn’t display it for you to download or copy and paste. Well, here’s the code:
There are two parts that you may have/want to change.The first is the two parts where it says “5000″. That’s how many milliseconds in between each fade, and I wanted 5 seconds.
The second is the line ‘css.setAttribute(“href”,”/css/xfade.css”);’. Simply change the “/css/xfade.css” to the location of the CSS file I’m about to show you:
Feel free to change anything in the #imageContainer section of the CSS file. The only parts that need to stay is the “position: relative;” and “margin: auto;”. I suggest setting the width and height to the width of the widest image and the height of tallest image.
Make sure you include the Javascript on the page, a line like:<script type=”text/javascript” language=”javascript” src=”/js/xfade.js”></script>
The last part is the actual pictures you want to cross fade into.
There is one thing you should pay attention to.
The <div id=”imageContainer”> contains all the images you want to fade into each other. This must remain the same.
Ok, so its been over a month since my last blog. I promise more are coming, I have a few topics I’d like to go over, such as cron jobs and yet another IE bug. Possibly some complaints about more horrible hosting… you know, the good stuff.
I would just like to announce that my site, http://www.phoenixdev.net, has gotten a new design. I’d love some feedback. I haven’t fixed up all the CSS on certain headings – but I’m talking about the overall look.