Javascript/jquery change css depending on url -


i need create script thant changes css of page, depending on url inserted user.

for example

if use url: http://mypage.com/ shows css: <link rel="stylesheet" type="text/css" href="cssfolder/style.css">

but need if use url example: http://mypage.com/#color1 (or url format consider better achieve same)

i need change new css, based on url, , overwrite it, showing this: <link rel="stylesheet" type="text/css" href="cssfolder/user1.css">

i need uses css based on url, replacing css file name.

this way if user enters site http://mypage.com/#color1 show blue.css (changing blue, change logo blue...) , if enters http://mypage.com/#red, css changes red.css, showing red, content same.

anyone has idea how can done?

this hash value , load it. if changing # @ runtime, need make sure delete previous, assuming once.

var hash_var = window.location.hash; if (hash_var){     $("<link />").attr({       rel:"styleheet",        type:"text/css",       href:hash_var.substring(1) + ".css"     }).appendto("head"); } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -