0
我使用的骨幹和有以下幾種觀點:的jQuery的.css()的FF不工作,但確實在Chrome和Safari的工作
class GT.RunManager.Views.FloorplanView extends Backbone.View
className: 'floorplan-view'
events:
'click .violation-marker' : 'edit_location'
'click' : 'create_location'
initialize: (@options) ->
@run = @options.run
@student = @options.student
@floorplan = @options.run.get('floorplan')
@locations = new GT.RunManager.Collections.Locations()
@locations.run = @options.run
@locations.on 'add', @set_marker
@locations.on 'reset', @load_markers
@run.on 'remove_location', (location) =>
location.destroy() if location
@load_markers()
@locations.fetch data: { student_id: @student.id }
@render()
render: =>
if @floorplan
@$el.css 'background-image', "url(data:image/png;base64,#{@floorplan.url})"
this
create_location: (e) =>
@locations.create x: e.offsetX - 10, y: e.offsetY - 10, student_id: @student.id, run_id: @run.id
load_markers: =>
@$el.find('i').remove()
@locations.each (location) => @set_marker(location, false)
set_marker: (location, prompt = true) =>
marker = new GT.RunManager.Views.ViolationMarker(location: location, x: location.get('x'), y: location.get('y'))
@$el.append marker.el
if prompt
@run.trigger 'violations:set', location
:
class GT.RunManager.Views.ViolationMarker extends Backbone.View
className: 'violation-marker'
template: JST['app/templates/violation_marker']
initialize: (@options) ->
@x = @options.x
@y = @options.y
@location = @options.location
@render()
render: =>
@$el.html @template()
@$el.data 'location', @location
@$el.css
'top': @y
'left': @x
this
這是從所謂的這個想法是在用戶觸摸它的屏幕上放置一個圖標(在iPad上,用於實驗)。它在Chrome和Safari中運行良好,但在Firefox中不起作用,其中圖標位於父div的左上角。
任何想法?
編輯:這骨幹視圖風格與下面的CSS:
div.violation-marker {
position: absolute;
background-color: red;
@include border-radius(6px);
padding: 4px;}
模板僅僅是(引導):
<i class="icon icon-fire icon-white"></i>
和父格樣式爲:
.floorplan-view {
position: relative;
float: left;
margin-left: 100px;
width: 755px;
height: 755px; }
其他CSS應用於'@ el'及其父元素? –
這是唯一適用於@el的css。它有一個類的CSS'div.violation-marker { } \t \t position:absolute; \t \t background-color:red; \t \t @include border-radius(6px); \t \t padding:4px; \t}' – John
父母呢?父母的位置是:親戚嗎? '.violation-marker'沒有大小? –