1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

JS Variable for stylepath

Discussion in 'XenForo Development Discussions' started by ragtek, Jan 25, 2011.

  1. ragtek

    ragtek Guest

    I want to manipulate the css attribute in my js code.

    I'm having this in my code:
    Code:
                            $switchButton.css('background-image','url(styles/default/xenforo/widgets/togglesidebar_l.png)');
    
    The problem is, that the stylepaths is hardcoded.

    In vBulletin it was possible to use IMGDIR_MISC for this, because the variable was initialized by vBulletin.

    I couldn't find anything similar in the xenforo sourcecode.
    Is there also a variable in XF availabe or do i need to create this myself?
     
  2. Mike

    Mike XenForo Developer Staff Member

    The best way to do that is to simply switch classes, rather than updating the CSS directly.
     
  3. ragtek

    ragtek Guest

    HM, i don't wanted to make this, because it would be IMHO unnecessary c&p code

    Or can i shorten this to something clean? (Sadly I have no clue of css ATM :()
    Code:
    .breadcrumb .switchside_r
    {
    height: 13px;
    width: 13px;
    background: transparent url('@imagePath/xenforo/widgets/togglesidebar_r.png') no-repeat;
    margin: 5px;
    overflow:hidden;
    white-space: nowrap;
    display: block;
    float:right;
    }
    
    .breadcrumb .switchside_l
    {
    height: 13px;
    width: 13px;
    background: transparent url('@imagePath/xenforo/widgets/togglesidebar_l.png') no-repeat;
    margin: 5px;
    overflow:hidden;
    white-space: nowrap;
    display: block;
    float:right;
    }
     
  4. Mike

    Mike XenForo Developer Staff Member

    Code:
    .breadcrumb .switchside_r,
    .breadcrumb .switchside_l
    {
    	height: 13px;
    	width: 13px;
    	background: transparent url('@imagePath/xenforo/widgets/togglesidebar_r.png') no-repeat;
    	margin: 5px;
    	overflow:hidden;
    	white-space: nowrap;
    	display: block;
    	float:right;
    }
    
    .breadcrumb .switchside_l
    {
    	background: transparent url('@imagePath/xenforo/widgets/togglesidebar_l.png') no-repeat;
    }
     
    jmurrayhead and ragtek like this.

Share This Page