Jump to content

Modalbox Mod help


darkfreaks

Recommended Posts

okay so what i am doing is using a modalbox popup for my application. however i want to change the stylesheet  color meaning i would have to use more than one CSS stylesheet. the tricky part is coming up with a way to apply the changes so that it works without closing the modalbox popup when you click on the link it will change the theme according to the color link.

 

 

 

 

Link to comment
Share on other sites

okay i found a function that will switch the stylesheet but it wont work with modal as it currently is. it will just make the page reload with the default modal stylesheet. :wtf:

code:

<script type="text/javascript">

function changeActiveStyleSheet(previous, new)
{
if(document.styleSheets)
{
for (var StyleSheetIterator = 0; StyleSheetIterator <
document.styleSheets.length; StyleSheetIterator++)
{
if(document.styleSheets[styleSheetIterator].title == previous)
{
document.styleSheets[styleSheetIterator].disabled = true;
};
if(document.styleSheets[styleSheetIterator].title == new)
{
document.styleSheets[styleSheetIterator].disabled = false;
};
};
};
}

</script>
<script type="text/javascript" src="ajax.js"></script> 
<link rel="stylesheet" href="modalbox.css" title="Original Purple" type="text/css" 
media="screen" />
<link rel="stylesheet" href="orange.css" title="Orange Flavor" type="text/css" 
media="screen" />
<div id="links"><a href="" onclick="changeActiveStyleSheet('Orange Flavor', 'Original Purple');">Original Purple</a>|<a href="" onclick="changeActiveStyleSheet('Original Purple', 'Orange Flavor');">Orange Flavor</a></div>

Link to comment
Share on other sites

You probably will have to "return false" somewhere in your function or in your onclick event, because the link is still redirecting your to href="" after the onclick event is finished. "return false" will override that action.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.