beautypg.com

Media query, Dw.mediaquerylisttojson(strmediaquerylist), Site.getmediaqueryfile() – Adobe Dreamweaver API Reference CS5 User Manual

Page 424

background image

419

DREAMWEAVER API REFERENCE

Design

Last updated 8/27/2013

Media Query

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.