/    Sign up×
Community /Pin to ProfileBookmark

Javascript and CSS HELP PLEASE.

Hi, I’m obviously a NOOB when it comes to coding cause I’m stuck here.
My code load a javascript theme, simplified for example purposes:

example.loadTheme(‘http://www.blah.com/ABC.js‘);

in ABC.js, I have this:

example.loadTheme({css:’XYZ.css’});

now how can I make the css: point to a URL????? Thanks in advance!

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@untitlejkauthorNov 30.2010 — so I want to have it so in ABC.js, I have this instead:

example.loadTheme({css:'http://www.blah.com/XYZ.css'});

but this doesnt work.
Copy linkTweet thisAlerts:
@FangNov 30.2010 — Show the function loadTheme
Copy linkTweet thisAlerts:
@untitlejkauthorDec 01.2010 — G.loadTheme = function(obj) {

var theme = {};

var orig = ['name','author','version','defaults','init'];

var proto = G.prototype;

proto.loop(orig, function(val) {

if (!obj[ val ]) {

G.raise(val+' not specified in theme.');

}

if (val != 'name' && val != 'init') {

theme[val] = obj[val];

}

});

theme.init = obj.init;

if (obj.css) {
proto.loop(proto.getElements('script'), function(el) {
var reg = new RegExp('galleria.' + obj.name.toLowerCase() + '.js');
if(reg.test(el.src)) {
var css = el.src.replace(/[^/]*$/, "") + obj.css;
proto.loadCSS(css, function() {
G.theme = theme;
jQuery(document).trigger( G.THEMELOAD );
});
} else {
G.raise('No theme CSS loaded');
}
});
}
return theme;

};
Copy linkTweet thisAlerts:
@untitlejkauthorDec 04.2010 — anyone? help please
Copy linkTweet thisAlerts:
@FangDec 14.2010 — This is part of a gallery app. so the error is likely to be in the path or name of the css file, if the gallery works with the standard theme.

A better forum to solve any further issues is the Galleria forum.
Copy linkTweet thisAlerts:
@untitlejkauthorDec 14.2010 — thanks.. I went ahead and shared it on that site.
×

Success!

Help @untitlejk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...