Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Text onlyText only
Previous
 
Next
New Post
4/12/2007 4:50 PM
 

 

Thanks again.  I don't want to completely remove default . I just want to give site visitor the option of  chosing text only display with a single click to improve accesilbilty.  How do I edit the default.css to do this ?

 
New Post
4/12/2007 6:36 PM
 

You can achieve the desired goal by adding the following script I whipped up to your skin. The net result will be two hyperlinks -- Text Only and Text+Images. The user can click on the desired link to toggle images on/off on the page. Bear in mind that support for removing background images is flaky, so you may need to customize the script.

 

 

 

<script type="text/javascript">
var lastRuleDynamicallyAdded = false;

function addCSSRule (selectorText, declarations)
{
 if (document.styleSheets.length > 0)
 {
  var styleSheet = document.styleSheets[document.styleSheets.length - 1];
  if (styleSheet.insertRule)
  {
   styleSheet.insertRule(selectorText + ' { ' + declarations + ' }',styleSheet.cssRules.length);
   lastRuleDynamicallyAdded = true;
  }
  else if (styleSheet.addRule)
   {
    styleSheet.addRule(selectorText, declarations);
    lastRuleDynamicallyAdded = true;
   }
 }
}

function removeLastCSSRule (count)
{

 if (document.styleSheets.length > 0)
 {
  var styleSheet = document.styleSheets[document.styleSheets.length - 1];
  if (styleSheet.deleteRule)
  {
   for(var r=0;r<count;r++)
    styleSheet.deleteRule(styleSheet.cssRules.length-1);
   lastRuleDynamicallyAdded = false;
  }
  else if (styleSheet.removeRule)
   {
    for(var r=0;r<count;r++)
     styleSheet.removeRule(styleSheet.rules.length-1);
    lastRuleDynamicallyAdded = false;
   }
 }
}


function disableImages()
{
 if (lastRuleDynamicallyAdded) return;
 addCSSRule("img","display:none;");
 addCSSRule("*","background-image:none");
}

function enableImages()
{
 if (!lastRuleDynamicallyAdded) return;
 removeLastCSSRule(2);
}
</script>

<div><a href=" void(0)" onClick="disableImages()">Text Only</a> | <a href=" void(0)" onClick="enableImages()">Text and Images</a></div>

Nik

 


Nik Kalyani
Co-founder
DotNetNuke Corporation
Blog | Twitter | FaceBook
 
New Post
4/13/2007 4:26 AM
 

I didn't understand that you wanted text only as an option.

Editing default.css is not the way, since it will change things for every situation.

Nik's example is nice but I don't think it will work between postbacks, so for every loaded page the user would have to select the textonly option again.

You could however write the status to a Cookie with the technique described here

 
New Post
4/13/2007 5:37 AM
 

 A million thanks for the script Nik  !!.

I inserted it into my skin (testskin) and got a  "Page Not Found"  error  for the page ....../Portals/0/Skins/testskin/%20void(0)   whwen I click "text only"

What part of the script needs to be customised ?

 

 

cniknet wrote

You can achieve the desired goal by adding the following script I whipped up to your skin. The net result will be two hyperlinks -- Text Only and Text+Images. The user can click on the desired link to toggle images on/off on the page. Bear in mind that support for removing background images is flaky, so you may need to customize the script.

 

 

 

 

 

 

 

 

 

Nik

 

 
New Post
4/13/2007 5:45 AM
 

This is looking quite great Timo. How do I use the cookie script ? where do I add it ? Can I just include it in Nik's script ?

Thanks

 

Timo Breumelhof wrote

I didn't understand that you wanted text only as an option.

Editing default.css is not the way, since it will change things for every situation.

Nik's example is nice but I don't think it will work between postbacks, so for every loaded page the user would have to select the textonly option again.

You could however write the status to a Cookie with the technique described here

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Text onlyText only


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out