开发者

Setting a jQuery UI buttons text to false not working in Safari on Mac OS X 10.5

开发者 https://www.devze.com 2023-03-05 01:22 出处:网络
I am building a html menu and I am using jQuery UI to format the buttons.I want to create an icon only button.开发者_开发技巧Everything works fine for IE 9, Chrome and Safari on Windows 7.It also work

I am building a html menu and I am using jQuery UI to format the buttons. I want to create an icon only button.开发者_开发技巧 Everything works fine for IE 9, Chrome and Safari on Windows 7. It also works for Chrome on OS X but not Safari on OS X.

There is an interaction with a Google map that I have on the page. If I do not create the map the menu will render correctly with the icon only button. But if I create the map the menu disappears.

The failure occurs when I set the buttons text property to false. I have tried to do this 2 ways

(1)

$("#zoomIn").button({ icons: { primary: 'ui-icon-zoomin' }, text: false });

(2)

$("#zoomIn").button({ icons: { primary: 'ui-icon-zoomin' } });
$("#zoomIn").button("option", "text", false);

If I dont set this property the menu display correctly but there is text in the button.

The HTML for the button is

<button id="zoomIn">xxx</button>

I'm including the following files (these are from the jQuery UI demo page)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript"></script> 
<script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script> 

I have tried including local copies the jQuery libraries.

I'm baffled by this one. Hopefully someone else has run into this problem and solved it. Any help is much appreciated.


Finally tracked down the issue.

I am using a jQuery UI stylesheet, in which there is a style

.ui-button-icon-only .ui-button-text, .ui-button-icons-only 
.ui-button-text { padding: .4em; text-indent: -9999999px; }

setting text-indent to -999px; resolves the issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消