dw.mediaQueryListToJSON(strMediaQueryList)

Availability

Dreamweaver CS5.5.

Description

Parses a Media Query List string and returns a JSON string to the caller.

Arguments

strMediaQueryList

A string that is a Media Query list, similar to the media attribute of a link tag.

Returns

A JSON string that represents the parsed Media Query List. The caller can inspect this string and/or call eval to convert it into a JavaScript object.

If an error is encountered while parsing, the caller can use errorStr, a JSON object, for testing. If this property is non-existent or empty, there will be no error. When the parsing succeeds, the JSON object will have property called mediaQueryList, which is an array.

Example

var strJSON = dw.mediaQueryListToJSON('only screen and (min-width:769px)'); 
//strJSON is now: 
{ mediaQueryList : [ { restrictor : 'only', 
                        mediaType : 'screen', 
                        mediaFeatures : [ { feature : 'width', comparisonType : 'min', value : '769px' } ] } 
], 
errorStr : '' 
}

site.getMediaQueryFile()

Availability

Dreamweaver CS5.5.

Description

Provides the location of the site-wide media query file for the current site. For example, C:\Documents and Settings\username\My Documents\dw sites\slash site\css\devices.css.

Returns

String with full path of the SWMQF.

site.setMediaQueryFile()

Availability

Dreamweaver CS5.5.

Description

Sets site-wide media query file for the current site.

Returns

None

dom.collectMediaQueries()

Availability

Dreamweaver CS5.5.

Description

Gets Media Query info (css, Media Query, description/comment, offsets) on the document.

Returns

Array of strings.

Example

{ type: 'link', offsets: {start: 109, end: 213}, desc: 'for phone', descOffsets: {start: 89, end: 107}, mq: 'only screen and (max-width:320px)', css: 'phone.css' },{ type: 'link', offsets: {start: 236, end: 364}, desc: 'for tablet', descOffsets: {start: 215, end: 234}, mq: 'only screen and (min-width:3210px) and (max-width:700px)', css: 'tablet.css' }

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy