English 中文(简体)
Custom icon in TabPanel fails
原标题:

I m trying to add a custom icon to a TabPanel but when I do that it just shows a dark box with rounded corners.

My css looks like this: http://pastebin.org/447682

The code in the url is base64 for some random rss icon I found on the web. I also tried to add a relative url to an image but without any success.

If I change my code to use a base64 from the ext-touch.css file ( http://pastebin.org/447685 ) it works all fine, so why wouldn t it accept my custom icon?

Note: I don t need an rss icon. I just tried that for testing purposes.

最佳回答

MrSoundless — I worked on the theming engine in Sencha Touch. The problem is that the bottom tabs use WebKit masks for icons, not traditional background images. This allows us to fill the shape of the icon you pass, so we can dynamically change its color on selection. To get a traditional image in there, use background-image instead of -webkit-mask-box-image. Base64 encoding as you are should still be fine.

问题回答

for example in your .html file

 .image{
-webkit-mask-box-image: url( /public/images/btn.png );
}

and use the above defined image in your tabPanel

iconCls:  image ,

Although this question was asked in 2010, it still came up when I was searching for a solution. This functionality seems to have changed in Sencha 2.0, and I spent a while fighting it, so here is what is needed for 2.0 compatibility:

CSS/inline stylesheet

.x-tab .x-button-icon.XXXXX,
.x-button .x-button-icon.x-icon-mask.XXXXX {
  -webkit-mask-image: url( /img/1.png );
}

App.js tab panel definition

{
    title:  Your tab title ,
    iconCls:  XXXXX 
}

Where XXXXX is the name of your custom icon.

Hope that helps.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签