Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Created October 23, 2012 21:48
Show Gist options
  • Save eristoddle/3941863 to your computer and use it in GitHub Desktop.
Save eristoddle/3941863 to your computer and use it in GitHub Desktop.
Iphone and Android stuff
$(document).ready(function() {
var ua = navigator.userAgent.toLowerCase(),
isAndroid = ua.indexOf("android") > -1,
isiPhone = /iphone/i.test(ua),
positionSlides = function(){
$('.slides').css({
'margin-top': '20px'
});
},
resizeSlideText = function(){
var winWidth = $(window).width();
if(winWidth < 1024){
$('.content-wrapper .content .slides').css({
'font-size': winWidth * 0.09
});
}else{
$('.content-wrapper').css({
'font-size': '100px'
});
}
},
iPhoneFix = function(){
if(winWidth > 320){
  $('.ribbon-wrapper').css({
'bottom': '-30px'
});
$('.big-c').css({
'bottom': '0px'
});
}
},
loadFunction = function(){
$('.slides').css({
'width':'100%'
});
if($(window).width() <= 320){
if(isiPhone){
$('.mobile-wrapper').css({'height': (document.documentElement.clientHeight + 60) + 'px'});
}else{
$('.mobile-wrapper').css({'height': document.documentElement.clientHeight + 'px'});
}
$('.mobile-wrapper').backstretch('./images/mountain-back.jpg');
$('.banner-right').hide();
$('.mobile-contact').show();
}else{
$('.backstretch').remove();
$('body').backstretch('./images/mountain-back.jpg');
$('.banner-right').show();
$('.mobile-contact').hide();
$('body').css({
'height': $('.backstretch').height()
});
}
if(isiPhone){
iPhoneFix();
}
if(!isiPhone && !isAndroid){
resizeSlideText();
}
};
$('.slides').cycle({
fx: 'fade',
fit: 1,
containerResize: 1,
slideResize: 1,
//speed: 100,
//timeout: 100,
cleartype: true,
cleartypeNoBg: true,
width: '100%',
height: 'auto',
before: function(){
$(this).css({
'margin-top': '20px'
});
}
});
$(window).resize(function() {
loadFunction();
});
if (window.DeviceOrientationEvent) {
window.addEventListener('orientationchange', loadFunction, false);
}
loadFunction();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment