2013-07-13 26 views
0

流星會話設置和獲取在所有桌面瀏覽器上都能正常工作,但觸發會話的相同事件在移動Safari瀏覽器中「破碎」。在仍然使用Meteor Session變量的情況下是否有解決此問題的方法?Meteor.js - 會話在手機瀏覽器中不工作

這是一些代碼的例子。

Template.stream.events({ 
    'click #circusview': function() { 
    var thisValue = document.getElementById("circusview"); 
    var thisVal = thisValue.getAttribute("title"); 
    Session.set("selected", thisVal); 
    var theSesh = Session.get("selected"); 
    } 
}) 

Template.tweet.tmplView = function() { 
    var thisSesh = Session.get('selected'); 
    return thisSesh; 
} 

<template name="tweet"> 
    <div id="{{tmplView}}" class="tweet" style="background-image: url('{{backImg}}')" > 
    <img class="profile" src="{{profileImg}}"> 
    <span class="name">{{screenName}}</span> 
    <span class="message"> {{thisMessage}}</span> 
    </div> 
</template> 

此代碼在桌面瀏覽器上的工作原理類似於魅力,但不適用於移動Safari瀏覽器。謝謝您的幫助。

回答

0

移動Safari上發生了什麼? click功能是否被觸發?會話是否正確設置?你可以測試這些嗎?

試試這個變化:

Template.stream.events({ 
    'mouseup #circusview, touchend #circusview': function(e) { 
    Session.set('selected', $(e.target).attr('title')); 
    }, 
}); 
+0

謝謝。這是代碼正在工作。 Template.stream.events({0}){thisChashView.getElement(「title」); Session.set(「selected」,thisVal); }, –

0

由於休伯特 -

這裏是結束了桌面和移動使用的代碼。

Template.stream.events({ 
    'mouseup #circusview, touchend #circusview': function(e) { 
    var thisValue = document.getElementById("circusview"); 
    var thisVal = thisValue.getAttribute("title"); 
    Session.set("selected", thisVal); 
    } 
}) 
相關問題