inherit
190686
0
Feb 28, 2013 20:13:32 GMT -8
capasha
1
February 2013
capasha
|
Post by capasha on Feb 28, 2013 8:07:32 GMT -8
I have followed some guides how to create a plugin, I'm bad at Java Script too so I guess It's a really nice combination.
I'm trying to change the thread titles, but it doesn't work. And I guess I do something really wrong.
The text "Just a test" is where I want the color to be changed. Which doesn't work. (Looks like using </span> in codebox adding 4 more?, weird codebox issue)
<div class="container threads"> <span class="link target"> <a href="/thread/00/just-a-test">Just a test</a> <span> </span><span> </span></span> </div>
The Java Script I'm trying to use.
var my_test_plugin = (function() { return { init: function(){ this.threadTitle(); } }; )}();
threadTitle: function() { $("#content div.container.threads").each(function() { var threads = $(this); var title = threads.find("span.link.target"); title.css("color","#FF0000"); }); };
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Mar 1, 2013 11:48:27 GMT -8
Try doing something more like this in your threadTitle function:
$('#content .threads .main .link a').css('color', '#FF0000'); or even further, you can reduce your js to simply this:
$(document).ready(function() { $('#content .threads .main .link a').css('color', '#FF0000'); });
or even further, if you're just trying to turn all thread titles into a single, non-dynamic color (e.g., it will always be the same color), you can just add this one line to your Style Sheet instead: (Admin Area > Themes > Advanced Styles & CSS > Style Sheet)
#content .threads .main .link a { color: #FF0000; }
|
|