开发者

Jquery .removeAttr and .addClass on android

I am making a mobile-ready site accessible and am having an issue getting the simple jquery function to run. I'm a bit of a beginner at it but have used simple functions like this in a lot of projects without hitch. This is my first attempt at a mobile-ready site.

Test page: http://arrowoodphotography.com/spaces/test.html

I've tried (document).ready and the below. This works w/o a problem on desktops but not on mobile devices.

I need to remove the attributes so I can use the mobile stylesheet to size the slideshow Object. I can't seem to get it to work no matter what I do.

<script src="h开发者_开发百科ttp://code.jquery.com/jquery-1.5.min.js"></script>
<script>
$(window).load(function(){ 
    $("object").removeAttr("height");
    $("object").removeAttr("width");
    $("object").addClass("objectSize");
}); 
</script>

Any help is much appreciated


Maybe try .css('height','auto') and see if that does it?


I ran into a similar problem where I was trying to addclass and remove a class which contained a box-shadow property.

.requiredfocus
{
 box-shadow: 0 0 12px #FF2A2A;  
}

It seemed to work everywhere except on an android browser, after digging around a bit I realized Mozilla and Webkit still require their respective -moz- and -webkit- prefixes. Hence what worked for me was something like this.

.requiredfocus
{
 -webkit-box-shadow: 0 0 12px #FF2A2A;
 box-shadow: 0 0 12px #FF2A2A;
 -moz-box-shadow: 0 0 12px #FF2A2A;
}

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜