This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/assets/javascripts/mobile/orbit.mobile.js.erb

129 lines
4.1 KiB
Plaintext
Raw Normal View History

2012-12-19 19:21:50 +00:00
<%#= encoding: utf-8 %>
// function slideshow() {
// var $globalW = $(".global").width(),
// $slideImg = $(".slideImg"),
// $slidebanner = $(".slidebanner"),
// $slideshow = $(".slideshow"),
// $slideImgOW = $slideImg.width(),
// $slideImgOH = $slideImg.height();
// $slideImg.css({
// "widht": $globalW,
// "height": Math.floor(($globalW/$slideImgOW)*$slideImgOH),
// });
// $slideshow.css({
// "width": $globalW,
// "height": Math.floor(($globalW/$slideImgOW)*$slideImgOH),
// });
// alert(Math.floor(($globalW/$slideImgOW)*$slideImgOH))
// }
$('#index').live('pageinit',function(){
var $globalW = $(window).width(),
$slideshow = $(".slideshow");
$slideshow.css({
"width": $globalW, "height": Math.floor($globalW/720*240)
});
$(".slideImg").muImageResize({width: $globalW, height: Math.floor($globalW/720*240)});
$(this).find(".newpic img").muImageResize({width: 280, height: 200});
$('.slideshow').cycle({
2012-12-19 19:21:50 +00:00
fx:'scrollLeft',
timeout: 6000,
2012-12-19 19:21:50 +00:00
});
$(".newlist").css({
"width" : $(".newitem").outerWidth()*(Math.floor($globalW/$(".newitem").outerWidth()))+30,
})
// var oc_timer;
// clearTimeout(oc_timer);
// oc_timer = setTimeout(function () {
// $('.newlist').swipePlanes();
// }, 1000);
});
$('#announcement_content').live('pageinit',function(){
2012-12-19 19:21:50 +00:00
$(this).find(".newpic img").muImageResize({width: 320, height: 220});
});
var mobileDemo = { 'center': '24.987449, 121.576117', 'zoom': 17 };
$('#map').live('pageinit', function() {
var $windowH = $(window).height();
$("#map_canvas").css({
'height' : $windowH,
})
gmAPI.add('basic_map', function() {
$('#map_canvas').gmap({'center': mobileDemo.center, 'zoom': mobileDemo.zoom, 'disableDefaultUI':false, 'callback': function() {
var self = this;
self.addMarker({'position': this.get('map').getCenter() }).click(function() {
self.openInfoWindow({ 'content': "<%= I18n.t('mobile.location_description') %>" }, this);
});
}});
}).load('basic_map');
});
$('#map').live('pageshow', function() {
gmAPI.add('basic_map', function() { $('#map_canvas').gmap('refresh'); }).load('basic_map');
});
$(document).bind('pagebeforehide',function(){
$("section.main-menu").removeClass("expanded");
});
$(document).bind("ready", function(){
// $(".openmenu").live("tap", function(){
// $("section.main-menu").toggleClass("expanded");
// return!1
// });
$("body").delegate(".openmenu","vclick",function(){
$("section.main-menu").toggleClass("expanded");
return!1
});
// alert(navigator.userAgent)
// $(".newpic img").muImageResize({width: 280, height: 100});
// $('.newlist').swipePlanes();
});
// $(window).resize(function(){
// alert("Resize");
// $(".slidebanner").removeAttr("style");
// $(".slidebanner").find("div").removeAttr("style");
// $(".slideImg").removeAttr("style");
// var $globalW = $(window).width(),
// $slideshow = $(".slideshow");
// $slideshow.css({
// "width": $globalW, "height": Math.floor($globalW/720*240)
// });
// $(".slideImg").muImageResize({width: $globalW, height: Math.floor($globalW/720*240)});
// $('.slideshow').cycle({
// fx:'scrollLeft',
// timeout: 6000,
// });
// });
$(window).bind("orientationchange", function(){
var oc_timer;
clearTimeout(oc_timer);
oc_timer = setTimeout(function () {
$(".slidebanner").removeAttr("style");
$(".slidebanner").find("div").removeAttr("style");
$(".slideImg").removeAttr("style");
// $(".newlist").removeAttr("style");
// $(".newlist").find(".clear").removeAttr("style");
// $(".newitem").removeAttr("style");
// $(".newlist").find(".clear").nextAll("div").remove();
var $globalW = $(window).width(),
$slideshow = $(".slideshow"),
$windowH = $(window).height();
$slideshow.css({
"width": $globalW, "height": Math.floor($globalW/720*240)
});
$(".slideImg").muImageResize({width: $globalW, height: Math.floor($globalW/720*240)});
$('.slideshow').cycle({
fx: $effect,
timeout: $timeout
2012-12-19 19:21:50 +00:00
});
$(".newlist").css({
"width" : $(".newitem").outerWidth()*(Math.floor($globalW/$(".newitem").outerWidth()))+30,
})
$("#map_canvas").css({
'height' : $windowH,
})
// $('.newlist').swipePlanes();
}, 500);
});